# ngx\_http\_stub\_status\_module

* [示例配置](/nginx-docs/he-xin-gong-neng/http/ngx_http_stub_status_module.md#example_configuration)
* [指令](/nginx-docs/he-xin-gong-neng/http/ngx_http_stub_status_module.md#directives)
  * [stub\_status](/nginx-docs/he-xin-gong-neng/http/ngx_http_stub_status_module.md#stub_status)
* [数据](/nginx-docs/he-xin-gong-neng/http/ngx_http_stub_status_module.md#data)
* [内嵌变量](/nginx-docs/he-xin-gong-neng/http/ngx_http_stub_status_module.md#embedded_variables)

`ngx_http_stub_status_module` 模块提供对基本状态信息的访问的支持。

默认不构建此模块，可在构建时使用 `--with-http_stub_status_module` 配置参数启用。

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

```
location = /basic_status {
    stub_status;
}
```

此配置将创建一个简单的网页，其基本状态数据可能如下：

```
Active connections: 291 
server accepts handled requests
 16630948 16630948 31070465 
Reading: 6 Writing: 179 Waiting: 106
```

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

### stub\_status

| -       | 说明                |
| ------- | ----------------- |
| **语法**  | **stub\_status**; |
| **默认**  | ——                |
| **上下文** | server、location   |

可以从包含该指令的 location 访问基本状态信息。

> 在 1.7.5 之前的版本中，指令语法需要一个任意参数，例如 `stub_status on`。

## 数据

提供以下状态信息：

* `Active connections`

  当前活动客户端连接数，包括等待连接。
* `accepts`

  已接受的客户端连接总数。
* `handled`

  已处理连接的总数。通常，参数值与 `accept` 相同，除非已达到某些资源限制阈值（例如，[worker\_connections](/nginx-docs/he-xin-gong-neng.md#worker_connections) 限制）。
* `requests`

  客户端请求的总数。
* `Reading`

  nginx 正在读取请求头的当前连接数。
* `Writing`

  nginx 将响应写回客户端的当前连接数。
* `Waiting`

  当前等待请求的空闲客户端连接数。

## 内嵌变量 <a href="#embedded_variables" id="embedded_variables"></a>

`ngx_http_stub_status_module` 模块支持以下内嵌变量（1.3.14）：

* `$connections_active`

  与 `Active connections` 的值相同
* `$connections_reading`

  与 `Reading` 的值相同
* `$connections_writing`

  与 `Writing` 的值相同
* `$connections_waiting`

  与 `Waiting` 的值相同

## 原文档

* <http://nginx.org/en/docs/http/ngx_http_stub_status_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_stub_status_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.
