ngx_http_stub_status_module
這個(gè)模塊能夠獲取Nginx自上次啟動(dòng)以來(lái)的工作狀態(tài)
此模塊非核心模塊,需要在編譯的時(shí)候手動(dòng)添加編譯參數(shù) –with-http_stub_status_module
./configure –with-http_stub_status_module
配置說(shuō)明
location /nginx_status {
stub_status on;
access_log off;
allow SOME.IP.ADD.RESS;
deny all;
}
或配置成認(rèn)證:
location /nginx_status {
stub_status on;
access_log off;
auth_basic “nginx_status”;
auth_basic_user_file conf/htpasswd;
}
其中htpasswd,可用apache htpasswd工具生成或者用在線生成工具生成
指令:stub_status
語(yǔ)法: stub_status on
默認(rèn)值: None
作用域: location
創(chuàng)建一個(gè) location 區(qū)域啟用 stub_status
“stub status” 模塊返回的狀態(tài)信息跟 mathopd’s 的狀態(tài)信息很相似. 返回的狀態(tài)信息如下:
Active connections: 291
server accepts handled requests
16630948 16630948 31070465
Reading: 6 Writing: 179 Waiting: 106
active connections — 對(duì)后端發(fā)起的活動(dòng)連接數(shù)
server accepts handled requests — nginx 總共處理了 16630948 個(gè)連接, 成功創(chuàng)建 16630948 次握手 (證明中間沒(méi)有失敗的), 總共處理了 31070465 個(gè)請(qǐng)求 (平均每次握手處理了 1.8個(gè)數(shù)據(jù)請(qǐng)求)
reading — nginx 讀取到客戶端的Header信息數(shù)
writing — nginx 返回給客戶端的Header信息數(shù)
waiting — 開(kāi)啟 keep-alive 的情況下,這個(gè)值等于 active – (reading + writing),意思就是Nginx說(shuō)已經(jīng)處理完正在等候下一次請(qǐng)求指令的駐留連接