我使用的Apache2 web服务器和我已经安装了mod_xsendfile 我有类似:X-SENDFILE错误,未找到文件
header('Content-type: application/zip');
header('Content-Disposition: attachment; filename="file.zip"');
//header("X-Accel-Redirect: /file/protected/file.zip"); //for nginx server
header('X-Sendfile: /protected/file.zip');
exit();
我/etc/apache2/apache2.conf中启用:
XSendFile on
当我/file/index.php点击下载按钮,它给我的错误,的index.php位于/文件/未找到
我试图在第一移动header('X-Sendfile: /file/protected/file.zip');
的地方,但它是相同的..
当我使用header("X-Accel-Redirect: /file/protected/file.zip");
它的工作原理,但给我的空.zip文件,反正它不Apache2的服务器..
文件只有几KB
任何人都知道如何修理它 ?
编辑: 它说,在error.log中:给出的路径是根路径之上:xsendfile:无法找到文件:/protected/file.zip
我设置XSendFilePath /保护和埃罗现在是: (2)No such a file or directory: xsendfile cannot open file: /protected/file.zip,referer: http://domain.com/file/
我必须在.htaccess文件中设置/文件/文件夹中的这些目录,在apache2。 conf或在/sites-available/domain.com? – takeit 2012-07-10 14:01:27
根据文档(https://tn123.org/mod_xsendfile/),指令 XSendFilePath/abs/path 应该可以在apache2.conf级别或在.htaccess文件中工作(假设允许覆盖已设置)。 – Robert 2012-07-10 19:56:33
谢谢你的工作:) – takeit 2012-07-11 16:13:28