1.开启NGINX状态页stub_status
# vim /etc/nginx/conf.d/default.conf server { listen *.80 default_server; server_name localhost _; location / { return 403; } location /nginx-status { stub_status on; access_log off; allow 127.0.0.1; deny all; } }
2.检测配置文件,重启NGINX
# nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful # /etc/init.d/nginx reload Reloading nginx: [ OK ]
3.获取NGINX状态
# curl http://127.0.0.1/nginx-status Active connections: 96 server accepts handled requests 1477130 1477130 6514839 Reading: 0 Writing: 7 Waiting: 89 ### 参数解释 active connections – 活跃的连接数 server accepts — 总共处理了1477130个连接; handled — 成功创建了1477130次握手; requests — 总共处理了6514839个请求; reading — 读取客户端的连接数. writing — 响应数据到客户端的数量 waiting — 已经处理完正在等候下一次请求指令的驻留连接。开启keep-alive时,等于 active–(reading+writing)
我来说说