ngx_http_index_module模块
| 示例配置 指令 index |
ngx_http_index_module模块处理以斜杠字符(“/”)结尾的请求。这样的请求也可以由ngx_http_autoindex_module和ngx_http_random_index_module模块处理。
示例配置
location / {
index index.$geo.html index.html;
}
指令
| 语法: | index |
|---|---|
| 默认值: |
index index.html; |
| 上下文: | http, server, location |
定义将用作索引的文件。 file 名称可以包含变量。文件按指定顺序检查。列表的最后一个元素可以是具有绝对路径的文件。 例如:
index index.$geo.html index.0.html /index.html;
应注意,使用索引文件会导致内部重定向,并且请求可以在不同位置处理。 例如,使用以下配置:
location = / {
index index.html;
}
location / {
...
}
一个“/”请求实际上将在第二个位置作为“/index.html”处理。
