网上搜索了一下午才找到怎么配置 Apache 的 X-sendfile .
首先,据说只有Apache 2.x 才支持这一特性.其次Linux下支持此特性需要内核支持.一般现在的2.6的内
核都是支持的,最早好像是要到2.2的内核开始支持.
测试环境 :
系统:Windows XP
Apache 版本 :
2.11
辅助脚本 :
PHP 5.2.6
配置步骤:
1.下载模块文件
在 http://www.apachelounge.com/download/ 下载
一个windows 下编译好的x-sendfile 模块 mod_xsendfile-0.9-w32.zip .解压后将文件 mod_xsendfile.so 移动到 apache/modules 目录下.
2.配置Apache 配置文件
将以下内容配置到配置文件中
# 加载 x-sendfile 模块
LoadModule xsendfile_module modules/mod_xsendfile.so
XSendFile On
XSendFileAllowAbove On
3.使用PHP调用X-sendfile
实例代码: