1 Nginx状态监控status
该ngx_http_stub_status_module
模块提供对基本状态信息的访问。http_stub_status_module模块
1.1 语法
Syntax: | stub_status |
---|---|
Default: | — |
Context: | server , location |
1.2 代码使用方法
vim /etc/nginx/conf.d/default.conf
location /nginx_status {
stub_status;
access_log off;
}
[root@nginx_web1 ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@nginx_web1 ~]# systemctl reload nginx
1.3 测试
浏览器访问 http://ip/站点目录
Active connections: 2 //当前连接数量
server accepts handled requests
166 166 160
accepts #连接总数
handled #连接成功总数
requests #已处理的连接总数
Reading: 0 Writing: 1 Waiting: 1
Reading #nginx正在读取请求标头的当前连接数。
Writing #nginx正在将响应写回到客户端的当前连接数。
Waiting #当前等待请求的空闲客户端连接数。