用过IIS的都知道IIS有个设置是开启目录浏览,同样Nginx也支持目录浏览功能,并且支持对特定目录设定目录浏览功能。
Nginx开启全站目录浏览功能:
编辑nginx.conf添加以下代码:
autoindex on; #开启nginx目录浏览功能
autoindex_exact_size off; #文件大小从KB开始显示
autoindex_localtime on; #显示文件修改时间为服务器本地时间
如果对特定网站则的特定路径,比如只对soft目录:
location /soft {
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
}
记得重启Nginx哦

