业务需求需要使用nginx搭建一个小的文件服务器,使用网络上找来的配置方法如下:
location /file_download {
root/home/oicq/dev_adtools;
autoindex off;
default_type 'application/octet-stream';
add_header Content-disposition "attachment";
}
这个方法没有成功,更改一处后成功了,就是根目录配置中的root改为alias。修改后的配置如下:
location /file_download {
alias /home/oicq/dev_adtools;
autoindex off;
default_type 'application/octet-stream';
add_header Content-disposition "attachment";
}
原因不明。