Nginx 启用ngx_http_stub_status_module 模块实现对Nginx 状态查询

我们通常需要对Nginx 的一些状态进行监控。
nginx 是有一个状态页的.详细介绍见官方文档 :http://nginx.org/en/docs/http/ngx_http_stub_status_module.html

  • 默认情况下,该模块,是没有构建的,需要使用 --with-http_stub_status_module 配置参数启用。

实例配置:

location = /basic_status {
    stub_status;
    allow 127.0.0.1;
    deny all;
}

为了安全起见,我们在后面加了 allow 127.0.0.1,也就是只能是本机访问,不允许其他机器访问。

返回的数据一般为:

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

Active connections: 当前活动的客户端连接数,包含Waiting 连接数。

accepts: 接受的客户端连接总数

handled: 已处理的连接总数,通常该参数值与 accepts 应该是一致的,除非得到某个限制(worker_connections).

requests: 客户端请求总数。

Reading: nginx 正在读取请求标头的当前连接数。

Writing: nginx 正在将响应写回到客户端的当前连接数。

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

原文地址:https://www.cnblogs.com/operationhome/p/12098949.html