启用Sendfile下载支持
AaronLiu edited this page 2018-03-11 16:11:13 +08:00
This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

启用sendfile模式后可大大降低用户下载文件时服务端的压力目前本功能仅对本地类型策略有效。使用前请先在后台-设置-杂项中启用X-Sendfile传输模式并根据你使用的服务器软件选择正确的Header并更改服务器配置

Apache

  1. https://www.apachelounge.com/download/ 下载并安装mod_xsendfile
  2. 在站点配置文件中加载并启用模块:
LoadModule xsendfile_module modules/mod_xsendfile.so
XSendFile On 
XSendFileAllowAbove On

注:如果下载下载的文件为空文件,则说明后台Sendfile Header选项 选择有误。若

Nginx

在站点配置文件中添加

location /protected_files {
    internal;
    #此处为public/uploads目录的绝对路径
    alias  /home/wwwroot/file.cloudreve.org/public/uploads/;
}