Home > Article > Operation and Maintenance > How to configure status monitoring in nginx
Nginx has a built-in status page, which needs to be opened by specifying the --with-http_stub_status_module parameter during compilation.
In other words, this function is provided by the http_stub_status_module module and is not loaded by default.
Configuration file example
server{ listen 80; server_name www.xxx.com; location /status/ { stub_status on; access_log off; allow 127.0.0.1; allow 192.168.10.0/24; deny all; } }
Configuration instructions
location /status/such that when accessing/ You can access the content of the status page by clicking status/.
stub_status on opens the status page.
access_log off does not record logs
allow and deny only allow access to specified IPs and IP segments, because this page needs to be protected and does not Public, of course, user authentication can also be done.
Testing and Results Description
测试命令:curl -x127.0.0.1:80 www.xxx.com/status/ 结果如下: Active connections: 1 server accepts handled requests 11 11 11 Reading: 0 Writing: 1 Waiting: 0 说明: active connections – 活跃的连接数量 server accepts handled requests — 总共处理的连接数、成功创建的握手次数、总共处理的请求次数 需要注意,一个连接可以有多次请求。 reading — 读取客户端的连接数. writing — 响应数据到客户端的数量 waiting — 开启 keep-alive 的情况下,这个值等于 active – (reading+writing), 意思就是 Nginx 已经处理完正在等候下一次请求指令的驻留连接.
The above is the detailed content of How to configure status monitoring in nginx. For more information, please follow other related articles on the PHP Chinese website!