Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nginx启用nginx status状态详解 #49

Open
hehongwei44 opened this issue Nov 21, 2015 · 1 comment
Open

Nginx启用nginx status状态详解 #49

hehongwei44 opened this issue Nov 21, 2015 · 1 comment

Comments

@hehongwei44
Copy link
Owner

nginx和php-fpm一样内建了一个状态页,对于想了解nginx的状态以及监控nginx非常有帮助。

1. 启用nginx status配置

在默认主机里面加上location或者你希望能访问到的主机里面。

server {
    listen  *:80 default_server;
    server_name _;
    location /ngx_status 
    {
        stub_status on;
        access_log off;
        #allow 127.0.0.1;
        #deny all;
    }
}

2. 重启nginx

 # service nginx restart

3. 打开status页面

# curl http://127.0.0.1/ngx_status
Active connections: 11921 
server accepts handled requests
 11989 11989 11991 
Reading: 0 Writing: 7 Waiting: 42

4. nginx status详解

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant