首页 > 其他 > 详细

配置 Nginx 的目录浏览功能

时间:2018-06-18 12:27:28      阅读:201      评论:0      收藏:0      [点我收藏+]

Nginx 默认是不允许列出整个目录的,需要配置 Nginx 自带的 ngx_http_autoindex_module 模块实现目录浏览功能 。

location / {
    alias /opt/files/;
    
    autoindex on;
    autoindex_exact_size off;
    autoindex_localtime on;
}

autoindex_exact_size off;
默认为on,显示出文件的确切大小,单位是bytes。
改为off后,显示出文件的大概大小,单位是kB或者MB或者GB

autoindex_localtime on;
默认为off,显示的文件时间为GMT时间。
改为on后,显示的文件时间为文件的服务器时间

REFER:
http://nginx.org/en/docs/http/ngx_http_autoindex_module.html
http://www.swiftyper.com/2016/12/08/nginx-autoindex-configuration/

配置 Nginx 的目录浏览功能

原文:https://www.cnblogs.com/Irving/p/9194800.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!