首页 > 其他 > 详细

nginx状态页面开启和监控

时间:2021-05-31 21:52:47      阅读:24      评论:0      收藏:0      [点我收藏+]

 

开启状态页面

开启status:

location /status {
  stub_status {on | off};
  allow 172.16.0.0/16;
  deny all;
}

访问状态页面的方式:http://server_ip/status

 

 

状态页面信息详解:

状态码表示的意义
Active connections 2 当前所有处于打开状态的连接数
accepts 总共处理了多少个连接
handled 成功创建多少握手
requests 总共处理了多少个请求
Reading nginx读取到客户端的Header信息数,表示正处于接收请求状态的连接数
Writing nginx返回给客户端的Header信息数,表示请求已经接收完成,
且正处于处理请求或发送响应的过程中的连接数
Waiting 开启keep-alive的情况下,这个值等于active - (reading + writing),
意思就是Nginx已处理完正在等候下一次请求指令的驻留连接

 

 

 

 

 

//开启状态页面
[root@localhost ~]# vim /usr/local/nginx/conf/nginx.conf
...
...
        location /status {
            stub_status on;
        }
...
...

[root@localhost ~]# nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@localhost ~]# nginx -s reload
[root@localhost ~]# ss -antl
State     Recv-Q     Send-Q          Local Address:Port         Peer Address:Port     
LISTEN    0          128                   0.0.0.0:80                0.0.0.0:*        
LISTEN    0          128                   0.0.0.0:22                0.0.0.0:*        
LISTEN    0          128                      [::]:22                   [::]:*   

 

 

访问一下网页

技术分享图片

 

 

 

上面是所有人都可以访问状态页面,所以要授权

 

nginx状态页面开启和监控

原文:https://www.cnblogs.com/meijianbiao/p/14833049.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!