[root@web1 ~]# vim /usr/local/nginx/conf/nginx.conf
47 location /status {
48 stub_status on;
49 }
# 檢查語法,出現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
# 訪問監控頁面
[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之間的連接數。它等于下面Reading / Writing/ Waiting之和
# accepts:自nginx啟動之后,客戶端訪問的總量
# handled:自nginx啟動之后,處理過的客戶端連接總數。
# requests:自nginx啟動之后,處理過的客戶端請求總數。
# Reading:正在讀取http請求頭部的連接總數。
# Writing:正在向客戶端發送響應的連接總數。
# Waiting:空閑連接。
# 使用工具向服務器發起多個請求
[root@web1 ~]# yum install -y httpd-tools
# 一共發1000個請求,每次并發數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