模块 ngx_http_index_module

示例配置
Directives
索引

该模块处理请求 以斜杠字符 ('') 结尾。 此类请求也可以由 ngx_http_autoindex_modulengx_http_random_index_module 模块处理。ngx_http_index_module/

示例配置

location / {
    index index.$geo.html index.html;
}

Directives

语法: index file ...;
默认值:
index index.html;
上下文: http, ,serverlocation

定义将用作索引的文件。 名称可以包含变量。 按指定的顺序检查文件。 列表的最后一个元素可以是具有绝对路径的文件。 例:file

index index.$geo.html index.0.html /index.html;

应该注意的是,使用索引文件会导致internal重定向, 并且可以在其他位置处理请求。 例如,使用以下配置:

location = / {
    index index.html;
}

location / {
    ...
}

“” 请求实际上将在 第二个位置为 “”。//index.html