<!-- review: finished -->

<a id="http-index"></a>

# Index

该模块处理以斜杠字符 (`/`) 结尾的请求。这类请求也可以由 [http_autoindex](https://cn.angie.software//angie/docs/configuration/modules/http/http_autoindex.md#http-autoindex) 和 [http_random_index](https://cn.angie.software//angie/docs/configuration/modules/http/http_random_index.md#http-random-index) 模块处理。

<a id="configuration-example-24"></a>

## 配置示例

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

<a id="directives-25"></a>

## 指令

<a id="index-0"></a>

<a id="id3"></a>

### index

| [语法](https://cn.angie.software//angie/docs/configuration/configfile.md#configfile)   | `index` file ...;      |
|--------------------------------------------------------------------------------------|------------------------|
| 默认值                                                                                  | `index index.html;`    |
| [上下文](https://cn.angie.software//angie/docs/configuration/configfile.md#configfile)  | http, server, location |

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

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

需要注意的是，使用索引文件会导致内部重定向，并且请求可以在不同的位置进行处理。例如，使用以下配置：

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

location / {
    #    ...
}
```

一个 `"/"` 请求实际上将在第二个位置作为 `"/index.html"` 进行处理。
