location /download {
alias /home/download/;
sendfile on;
autoindex on; #默认是不允许列出整个目录的
autoindex_exact_size off;#关闭计算文件确切大小(单位bytes),
#只显示大概大小(单位kb、mb、gb)
autoindex_localtime on; #显示本机时间而非 GMT 时间
}
在服务器/home/download/目录下创建文件test.txt
下载地址:http://ip:端口/download/test.txt