首先编辑下载配置文件: vim /etc/nginx/conf.d/download.conf
server {
listen 端口号;
server_name ip地址;
charset utf-8;
root /home/local/download/;
location / {
autoindex on; #开启索引功能
autoindex_exact_size off; # 关闭计算文件确切大小(单位bytes),只显示大概大小(单位kb、mb、gb)
autoindex_localtime on; # 显示本机时间而非 GMT 时间
#add_header Content-Disposition "attachment;filename=$arg_attname";
}
location /download {
root /home/local/download/;
}
}
:wq保存退出
使修改后的配置文件生效:
sudo nginx -s reload