启用nginx status状态详解

1、安装nginx

 rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

yum install nginx -y

systemctl start nginx


2、启动nginx status

vi /etc/nginx/nginx.conf


http {

    include       /etc/nginx/mime.types;

    default_type  application/octet-stream;


    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '

                      '$status $body_bytes_sent "$http_referer" '

                      '"$http_user_agent" "$http_x_forwarded_for"';


    access_log  /var/log/nginx/access.log  main;


    sendfile        on;

server {

    listen  *:80 default_server;

    server_name _;

    location /ngx_status

    {

        stub_status on;

        access_log off;

        #allow 127.0.0.1;

        #deny all;

    }

}

    #tcp_nopush     on;

修改后保存


systemctl restart nginx

[root@localhost ~]# curl http://192.168.0.115/ngx_status

Active connections: 1 

server accepts handled requests

 11 11 29 

Reading: 0 Writing: 1 Waiting: 0 


nginx status详解

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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章