# 随机主页 (http\_random\_index\_module)

## 配置语法

| http\_random\_index\_module |                         |
| --------------------------- | ----------------------- |
| 语法                          | random\_index on \| off |
| 默认                          | random\_index off       |
| 作用域                         | location                |

### 例子:

```
    location / {
        root   /www/nginx/code; #随机读取/www/nginx/code下一个文件来显示
        random_index on;
    }

    # 特别注意！！！！
    # 如果我设置的 location 是 /random 则实际访问的是/www/nginx/code/random 这个路径下的文件是随机读取的！
```


---

# 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://kingofzihua.gitbook.io/middleware-architecture-based-on-nginx/nginx-chang-yong-mo-kuai/sui-ji-zhu-ye-httprandomindexmodule.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.
