stub_status监控Nginx使用状况!

stub_status监控Nginx使用状况!php

查看nginx安装的模块!css

# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.8.1
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC) 
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module

有安装这个模块哦! 配置,html

server{
        listen 80;
        index index.html index.htm index.php;
		server_name xxx.com;
        root  /home/wwwroot/default/sheep/Public;
	
        location /nginx_status {
                stub_status on;
        		access_log off;
                allow all;
        }

        include enable-php-pathinfo.conf;

        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }

        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }

        location ~ /\.
        {
            deny all;
        }

        access_log  /home/wwwlogs/sheep/access.log  main;
}

查看结果,在浏览器中查看!nginx

http://www.xxx.com/nginx_status
Active connections: 132 
server accepts handled requests
 1576 1576 2334 
Reading: 0 Writing: 3 Waiting: 129

第一行     当前的活跃链接数:132 #等于 Reading + Writing + Waiting 第二行     服务器已接受的链接数:1576(accepted connection #),已接收来自客户端的链接数,也是被Worker进程接收的链接数。     服务器已处理的链接数:1576(handled connection #),已被处理的链接总数,其值通常与accepts相等,除非受到了某些资源的限制,如:设置了worker_connections的数量限制。     服务器已处理的请求:2334(能够算出,平均每一个链接有 1.48 个请求)(handled connection #) 第三行     Reading – Nginx 正在读取请求头的链接数为 0;     Writing – Nginx 正在读取请求体、处理请求并发送响应给客户端的链接数为 3;     Waiting – 当前活动的长链接数:129。 #只是keep-alive,没有活动的链接。浏览器

相关文章
相关标签/搜索