您的位置主页 > 服务器专区 > Apache > freebsd apache x-sendfile

freebsd apache x-sendfile

2010-05-18    文章来源:原创    浏览次数:1381     分享文章

安装X-Sendfile:

cd /usr/ports/www/mod_xsendfile/
make install clean

开启X-Sendfile模块:

vi /usr/local/etc/apache22/httpd.conf

把#LoadModule xsendfile_module   libexec/apache22/mod_xsendfile.so的#去掉

在需要开启X-Sendfile的虚拟主机加入

XSendFile on
XSendFileAllowAbove on

重启apache:

apachectl stop
apachectl start

下载测试:

X-Sendfile.php
  1.     $src_path = "/home/owner/file.tar.gz";
  2.     header('Pragma: public');
  3.     header('Content-Disposition: attachment; filename=file.tar.gz');
  4.     header('Content-Type: application/octet-stream');
  5.     header("X-Sendfile: {$src_path}");
  6. ?>

 

 

 

 

文章评论(查看全部)

昵 称 *
电子邮箱 *
网 址      0 + 2 = ?