模块 ngx_http_index_module
| Example Configuration Directives 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”进行处理。
