我们有时候访问某个 URI
的时候想要到是可以把整个目录都列出来,nginx默认是关闭的,但是我们可以打开autoindex
模块功能来实现.
配置方法:
location / {
autoindex on;
}
autoindex
可选值为on/off
,默认是off
,可以在配置文件中的http
, server
, location
位置进行配置
还有两个附带参数:autoindex_exact_size
和autoindex_localtime
autoindex_exact_size
可选值为on/off
,默认是on
,可以在配置文件中的http
, server
, location
位置进行配置
功能说明:
配置为on显示文件的字节大小,比较精确,如果配置为off则显示M,或者G为单位的大小
autoindex_localtime
可选值为on/off
,默认是off
,可以在配置文件中的http
, server
, location
位置进行配置
功能说明:
开启以本地时间来显示文件时间的功能。默认为关(GMT时间)
)