nginx开启状态统计

启用统计模块

nginx需要启用状态统计模块--with-http_stub_status_module

配置

在默认主机location添加如下配置

1
2
3
4
5
6
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}

访问测试

1
2
3
4
5
$ curl http://127.0.0.1/nginx_status
Active connections: 6
server accepts handled requests
3542 3542 8539
Reading: 0 Writing: 1 Waiting: 5

nginx status详解

active connections 活跃的连接数量
server accepts handled requests 总共处理了11989个连接 , 成功创建11989次握手, 总共处理了11991个请求
reading 读取客户端的连接数
writing 响应数据到客户端的数量
waiting 开启 keep-alive 的情况下,这个值等于 active – (reading+writing), 意思就是 Nginx 已经处理完正在等候下一次请求指令的驻留连接

当前网速较慢或者你使用的浏览器不支持博客特定功能,请尝试刷新或换用Chrome、Firefox等现代浏览器