ngx_http_autoindex_module
模块处理以斜杠('/')结尾的请求,并生成目录列表。通常,当ngx_http_index_module
模块找不到索引文件时,会将请求传递给ngx_http_autoindex_module
模块。
我们看一个实例,具体分析一下:
location / {
index index.html;
autoindex on;
}
以上的示例配置表示index.html不存在时,nginx将会生成目录列表返回至客户端。
Syntax: autoindex on | off;
Default: autoindex off;
Context: http, server, location
启用或禁用目录列表输出。
Syntax: autoindex_exact_size on | off;
Default: autoindex_exact_size on;
Context: http, server, location
对于HTML格式,指定是在目录列表中输出确切的文件大小,还是四舍五入为千字节,兆字节和千兆字节。
Syntax: autoindex_format html | xml | json | jsonp;
Default: autoindex_format html;
Context: http, server, location
This directive appeared in version 1.7.9.
设置目录列表的格式。
使用JSONP格式时,使用callback请求参数设置回调函数的名称,如果参数丢失或值为空,则使用JSON格式。
可以使用ngx_http_xslt_module
模块转换XML输出。
Syntax: autoindex_localtime on | off;
Default: autoindex_localtime off;
Context: http, server, location
对于HTML格式,指定是在本地时区还是在UTC中输出目录列表中的时间。
ngx_http_autoindex_module
在nginx做为文件下载服务时非常有用,可以方便的浏览文件信息。
- END -
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有