# ngx\_http\_index\_module

ngx\_http\_mirror\_module# ngx\_http\_index\_module

* [示例配置](/nginx-docs/he-xin-gong-neng/http/ngx_http_index_module.md#example_configuration)
* [指令](/nginx-docs/he-xin-gong-neng/http/ngx_http_index_module.md#directives)
  * [index](/nginx-docs/he-xin-gong-neng/http/ngx_http_index_module.md#index)

`ngx_http_index_module` 模块处理以斜线字符（`/`）结尾的请求。这些请求也可以由[ngx\_http\_autoindex\_module](https://github.com/DocsHome/nginx-docs/tree/f6135c42a499e9fab0adb433738fcf8cd4041627/模块参考/http/ngx_http_autoindex_module.html) 和 [ngx\_http\_random\_index\_module](https://github.com/DocsHome/nginx-docs/tree/f6135c42a499e9fab0adb433738fcf8cd4041627/模块参考/http/ngx_http_random_index_module.html) 模块来处理。

## 示例配置 <a href="#example_configuration" id="example_configuration"></a>

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

## 指令 <a href="#directives" id="directives"></a>

### index

|       - | 说明                    |
| ------: | --------------------- |
|  **语法** | **index** `file ...`; |
|  **默认** | index index.html;     |
| **上下文** | http、server、location  |

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

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

应该注意的是，使用索引文件发起内部重定向，可以在不同的 location 处理请求。例如，使用以下配置：

```
location = / {
    index index.html;
}

location / {
    ...
}
```

`/` 请求实际上是将在第二个 location 处理为 `/index.html`。

## 原文档

<http://nginx.org/en/docs/http/ngx_http_index_module.html>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docshome.gitbook.io/nginx-docs/he-xin-gong-neng/http/ngx_http_index_module.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
