当前位置: > Linux服务器 > nginx >

nginx的stub_status状态信息解释

时间:2016-04-03 21:45来源:linux.it.net.cn 作者:IT

一、加载http_stub_status模块

 

[root@10.10.90.97 ~]# ./configure --prefix=/usr/local/nginx --with-http_stub_status_module 
[root@10.10.90.97 ~]# make && make install

 

二、修改nginx配置文件

 

在server中,添加如下代码:
location /NginxStatus {
  stub_status on;
  access_log on;
  auth_basic "NginxStatus";
  auth_basic_user_file htpasswd;
}
[root@10.10.90.97 ~]# htpasswd -c /usr/local/nginx/conf/htpasswd nginx_focus #连续输入两次密码
New password: 
Re-type new password: 
Adding password for user nginx_focus

重新加载nginx.conf:

 

[root@10.10.90.97 ~]# kill -USR1 `cat /usr/local/nginx/logs/nginx.pid`

    三、打开nginx的stub_status可以通过页面链接看到如下信息:

Active connections: 145 
server accepts handled requests
 1749 1749 3198 
Reading: 0 Writing: 3 Waiting: 142

参数详解:  

Active connections:145            
#nginx 正处理的活动连接数145个。

server accepts handled requests
 1749 1749 3198       
             
#nginx启动到现在共处理了 1749个连接 ,nginx启动到现在共成功创建 1749次握手 请求丢失数=(握手-连接),可以看出,我们没丢请求;总共处理了3198 次请求。

Reading: 0 Writing: 3 Waiting: 142 
#Reading :nginx读取到客户端的Header信息数。
#Writing : nginx返回给客户端的Header信息数。
#Waiting : Nginx已经处理完正在等候下一次请求指令的驻留连接.开启keep-alive的情况下,这个值等于active–(reading+writing)。



(责任编辑:IT)
------分隔线----------------------------
栏目列表
推荐内容