1. 程式人生 > >nginx--之狀態信息主機

nginx--之狀態信息主機

ip地址 data 原因 conn ID http onf 正在 成功

nginx--之狀態信息主機 ,

nginx_status.conf 配置文件如下:
server {
listen 80;
server_name 127.0.0.1;
location ~ /ngx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
allow 10.220.2.6; #允許zabbix訪問
deny all;
}
}

[root@ttxianpei vhosts]# curl 127.0.0.1/ngx_status
Active connections: 5
server accepts handled requests request_time
3533102 3533102 3828482 33105736
Reading: 0 Writing: 1 Waiting: 4

nginx status詳細說明
Active connections 對後端發起的活動連接數;
server accepts nginx共處理了3533102個連接;
handled 成功創建了3533102次握手;
requests 總共處理了3828482請求。
Reading: nginx讀取客戶端的header數
Writing: nginx返回給客戶端的header數
Waiting: nginx請求處理完成,正在等待下一請求指令的連接


[root@idc01-gyl-ams-00 vhosts]# pwd
/data/server/nginx/conf/vhosts
[root@idc01-gyl-ams-00 vhosts]# ll
total 8
-rw-r--r-- 1 root root 1862 Apr 5 16:34 oms.conf
-rw-r--r-- 1 root root 181 Apr 2 11:23 zabbix_nginx_status.conf

這裏先前遇到過一個坑,
oms的http接口地址是http://10.220.20.3:80,即以IP地址的形式去訪問的,原先的配置文件只有一個是oms.conf,添加了nginx_status.conf後,訪問oms的接口地址報404………

解決辦法:將 nginx_status.conf 重命名為 zabbix_nginx_status.conf後,訪問oms的接口正常。

原因:當請求不是走域名,而是走IP訪問的時候,根據nginx的匹配原理,一個nginx_status.conf和一個oms.missfresh.conf,nginx會優先匹配nginx_status.conf的虛擬主機文件,這樣所有的請求都訪問到了nginx_status.conf,導致訪問oms的接口報404異常。

nginx--之狀態信息主機