HTTP目录清单生成模块(HTTP Auto Index)
·摘要
这个模块提供自动目录列表。
连接请求仅在ngx_http_index_module中没有找到主页文件时才会请求这个模块。
location / {
autoindex on; #开启目录浏览下载功能
}
二级目录时也可以使用此功能
localtion /download/{
autoindex on; #开启目录浏览下载功能
autoindex_exact_size off;#指定文件大小显示为M默认是b
autoindex_localtime on; #开启以服务器本地时区显示文件修改日期 默认为 off,以 GMT 时间作为显示的文件时间;
alias /home/test/;
}
配置完成后,保存,重启nginx通过浏览器访问该路径时,会有如下效果。
指令: