啟用nginx status狀態詳解
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 已經處理完正在等候下一次請求指令的駐留連接.
啟用nginx status狀態詳解