ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
### StubStatus模块 这个模块能够获取Nginx自上次启动以来的工作状态 此模块非核心模块,需要在编译的时候手动添加编译参数 `--with-http_stub_status_module` __配置说明__ ~~~ location /nginx_status { : # copied from http://blog.kovyrin.net/2006/04/29/monitoring-nginx-with-rrdtool/ : stub_status on; : access_log off; : allow SOME.IP.ADD.RESS; : deny all; } ~~~ ### 指令 - [#stub_status stub_status] ### stub_status **语法:***stub_status* on **默认值:***None* **作用域:***location* 创建一个 location 区域启用 stub_status "stub status" 模块返回的状态信息跟 [mathopd's](http://www.mathopd.org/ "http://www.mathopd.org/") 的状态信息很相似. 返回的状态信息如下: ~~~ 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说已经处理完正在等候下一次请求指令的驻留连接 ### Examples [http://blog.kovyrin.net/2006/04/29/monitoring-nginx-with-rrdtool/](http://blog.kovyrin.net/2006/04/29/monitoring-nginx-with-rrdtool/ "http://blog.kovyrin.net/2006/04/29/monitoring-nginx-with-rrdtool/") [http://dev.2xlp.com/svn/nginx_config/trunk/conf/_rrd/__README__.txt](http://dev.2xlp.com/svn/nginx_config/trunk/conf/_rrd/__README__.txt "http://dev.2xlp.com/svn/nginx_config/trunk/conf/_rrd/__README__.txt")