自动索引#

该模块处理以斜杠字符 (/) 结尾的请求,并生成目录列表。通常,当 http_index 模块找不到索引文件时,请求会传递给 http_autoindex 模块。

配置示例#

location / {
    autoindex on;
}

指令#

autoindex#

语法

autoindex on | off;

默认值

autoindex off;

上下文

http, server, location

启用或禁用目录列表输出。

autoindex_exact_size#

语法

autoindex_exact_size on | off;

默认值

autoindex_exact_size on;

上下文

http, server, location

对于 HTML 格式,指定目录列表中是否输出精确的文件大小,或者将其四舍五入到千字节、兆字节和千兆字节。

autoindex_format#

语法

autoindex_format html | xml | json | jsonp;

默认值

autoindex_format html;

上下文

http, server, location

设置目录列表的格式。

当使用 JSONP 格式时,回调函数的名称通过 callback 请求参数设置。如果参数缺失或为空值,则使用 JSON 格式。

XML 输出可以通过 http_xslt 模块进行转换。

autoindex_localtime#

语法

autoindex_localtime on | off;

默认值

autoindex_localtime off;

上下文

http, server, location

对于 HTML 格式,指定目录列表中的时间是以本地时区还是以 UTC 输出。