Module ngx_http_index_module

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

Example Configuration

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

Directives

Syntax:index file ...;
Default:index index.html;
Context:http , server , location

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

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

应当注意,使用索引文件会导致内部重定向,并且可以在其他位置处理请求。例如,具有以下配置:

location = / {
    index index.html;
}

location / {
    ...
}

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