Nginx输出基本状态信息(Ngx_http_stub_module模块)

2021-05-15 22:27

阅读:544

标签:web;nginx;linux

输出Nginx基本状态信息(Ngx_http_stub_status_module)

官方文档:http://nginx.org/en/docs/http/ngx_http_status_module.html

官方定义:

The ngx_http_stub_status_module module provides access to basic status information.

This module is not built by default, it should be enabled with the --with-http_stub_status_module configuration parameter.

  注意:此模块在编译时启动,指定--with-http_stub_status_module;

#Example Configuration
location /basic_status {
    stub_status;
}

Syntax: stub_status;
Default:
Context: server, location

Context:适用配置段


演示环境:

Server:192.168.47.140

[root@GaoServer ~]# cat /etc/redhat-release 
CentOS Linux release 7.2.1511 (Core) 
[root@GaoServer ~]# uname -r
3.10.0-327.el7.x86_64
[root@GaoServer ~]# nginx -V
nginx version: nginx/1.10.2
......

相关配置:

[root@GaoServer ~]# vim /etc/nginx/conf.d/Vhost.conf
server {
        listen 80;
        location /status {
                stub_status;
        }
}
#测试
[root@GaoServer ~]# curl http://192.168.47.140/status
Active connections: 1 
server accepts handled requests
 23 23 50 
Reading: 0 Writing: 1 Waiting: 0

状态信息定义:(官方定义)

Active connections:  #当前的活动连接数(包括Waiting状态的连接);

    The current number of active client connections including Waiting connections.

accepts:  #从Nginx启动到此时一共已经接收的请求数;

    The total number of accepted client connections.

handled:  #已经被处理完成的请求;

    The total number of handled connections. Generally, the parameter value is the same as acceptsunless some resource limits have been reached (for example, the worker_connections limit).

requests:  #客户端发来的总请求数;

    The total number of client requests.

Reading:  #Nginx读取客户端请求报文的连接数;

    The current number of connections where nginx is reading the request header.

Writing:  #Nginx处于向客户端发送响应报文的连接数;

    The current number of connections where nginx is writing the response back to the client.

Waiting:  #等待客户端发送新请求的空闲连接数;

    The current number of idle client connections waiting for a request.

Nginx输出基本状态信息(Ngx_http_stub_module模块)

标签:web;nginx;linux

原文地址:http://gning.blog.51cto.com/11847592/1977171


评论


亲,登录后才可以留言!