ngx_http_stub_status_module 这个模块能够获取Nginx自上次启动以来的工作状态 此模块非核心模块,需要在编译的时候手动添加编译参数 –with-http_stub_status_module ./configure –with-http_stub_status_module 配置说明 location /nginx_status { stub_status on; access_log off; allow SOME.IP.ADD.RESS; deny all; } 或配置成认证: location /nginx_status { stub_status on; access_log off; auth_basic “nginx_status”; auth_basic_user_file conf/htpasswd; } 其中htpasswd,可用apache htpasswd工具生成或者用在线生成工具生成 指令:stub_status 语法: stub_status on 默认值: None 作用域: location 创建一个 location 区域启用 stub_status “stub status” 模块返回的状态信息跟 mathopd’s 的状态信息很相似. 返回的状态信息如下: Active connections: 291 server accepts handled requests 16630948 16630948 31070465 Reading: 6 Writing: 179 Waiting: 106 active connections — 对后端发起的活动连接数 server accepts handled requests — nginx 总共处理了 16630948 个连接, 成功创建 16630948 次握手 (证明中间没有失败的), 总共处理了 31070465 个请求 (平均每次握手处理了 1.8个数据请求) reading — nginx 读取到客户端的Header信息数 writing — nginx 返回给客户端的Header信息数 waiting — 开启 keep-alive 的情况下,这个值等于 active – (reading + writing),意思就是Nginx说已经处理完正在等候下一次请求指令的驻留连接