输出nginx的基本状态信息
模块:ngx_http_stub_status_module
输出信息示例:
Active connections: 291
server accepts handled requests #下面三个数分别对应accepts,handled,requests
16630948 16630948 31070465
Reading: 6 Writing: 179 Waiting: 106
Active connections:当前状态,活动状态的连接数
accepts:统计总值,已经接受的客户端请求的总数
handled:统计总值,已处理完成的客户端请求总数,一般和accepts相同,除非拒绝
requests:统计总值,客户端发来的总的请求数
Reading:当前状态,正在读取客户端请求报文首部的连接的连接数
Writing:当前状态,正在向客户端发送响应报文过程中的连接数
Waiting:当前状态,正在等待客户端发出请求的空闲连接数
示例:
配置: [[email protected] conf.d]# vi /etc/nginx/conf.d/test.conf server { listen 80; server_name www.magedu.tech; root /opt/testdir/; # limit_rate 2k; location / { limit_except GET { allow 10.0.0.126; deny all; } } location /nginx_status { stub_status; allow 127.0.0.1; #基于IP访问控制 allow 10.0.0.0/16; deny all; } location /admin { auth_basic "admin area"; auth_basic_user_file /etc/nginx/conf.d/.nginxpasswd; } location /image { alias /opt/image/; try_files $uri $uri/tree.jpg =404; } error_page 404 /404.html; location = /test.html { } } 访问测试: [[email protected] conf.d]# ab -c 100 -n 1000 http://www.magedu.tech/test.log
验证:
标签:状态,输出,accepts,连接数,nginx,location,conf,客户端 From: https://www.cnblogs.com/cnblogsfc/p/14498528.html