[root@web1 ~]# vim /usr/local/nginx/conf/nginx.conf
47 location /status {
48 stub_status on;
49 }
# 檢查語法,出現(xiàn)syntax is ok表示配置文件正確
[root@web1 ~]# /usr/local/nginx/sbin/nginx -t
# 啟動服務
[root@web1 ~]# /usr/local/nginx/sbin/nginx
[root@web1 ~]# ss -tlnp | grep :80
LISTEN 0 128 *:80
# 訪問監(jiān)控頁面
[root@web1 ~]# cURL http://192.168.4.100/status
Active connections: 1
server accepts handled requests
1 1 1
Reading: 0 Writing: 1 Waiting: 0
# Activeconnections:當前客戶端與nginx之間的連接數(shù)。它等于下面Reading / Writing/ Waiting之和
# accepts:自nginx啟動之后,客戶端訪問的總量
# handled:自nginx啟動之后,處理過的客戶端連接總數(shù)。
# requests:自nginx啟動之后,處理過的客戶端請求總數(shù)。
# Reading:正在讀取http請求頭部的連接總數(shù)。
# Writing:正在向客戶端發(fā)送響應的連接總數(shù)。
# Waiting:空閑連接。
[root@web1 ~]# yum install -y httpd-tools
# 一共發(fā)1000個請求,每次并發(fā)數(shù)100
[root@web1 ~]# ab -n 1000 -c 100 http://192.168.4.100/status
[root@web1 ~]# cURL http://192.168.4.100/status
Active connections: 1
server accepts handled requests
1040 1040 1004
Reading: 0 Writing: 1 Waiting: 0