Nginx中的stub_status模組主要用於查看Nginx的一些狀態資訊.
本模組預設是不會編譯進Nginx的,如果你要使用該模組,則要在編譯安裝Nginx時指定:
./configure –with-http_stub_status_module
Java代碼
[root@10.10.90.97 ~]# ./configure --prefix=/usr/local/nginx --with-http_stub_status_module [root@10.10.90.97 ~]# make && make install
查看已安裝的 Nginx 是否包含 stub_status 模組
#/usr/local/nginx/sbin/nginx-Vnginxversion:nginx/0.6.32builtbygcc3.4.620060404(RedHat3.4.6-10)configurearguments:--user=nginx--group=nginx--prefix=/home/nginx--with-http_stub_status_module
可以看到我安裝了這個模組。注意是-V -v的話只會顯示版本nginx version: nginx/0.6.32
開始配置nginx,在server塊中加入location 就行了
server{ location /nginx-status { allow -------- allow --------//允許的ip deny all;// stub_status on; access_log off; } }
重啟nginx
killall -s HUP nginx
然後請求www.domain.com/nginx-status 就行了,下面是結果
Active connections: 5server accepts handled requests 597080614359708061437560482010Reading: 0 Writing: 5 Waiting: 0
Active connections: 對後端發起的活動串連數.
Server accepts handled requests: Nginx總共處理了38810620個串連,成功建立38810620次握手(證明中間沒有失敗的),總共處理了298655730個請求.
Reading: Nginx 讀取到用戶端的Header資訊數.
Writing: Nginx 返回給用戶端的Header資訊數.
Waiting: 開啟keep-alive的情況下,這個值等於 active – (reading + writing),意思就是Nginx已經處理完成,正在等候下一次請求指令的駐留串連.
所以,在訪問效率高,請求很快被處理完畢的情況下,Waiting數比較多是正常的.如果reading +writing數較多,則說明並發訪問量非常大,正在處理過程中.
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i <= lines; i++) { $numbering.append($('
').text(i)); }; $numbering.fadeIn(1700); }); });
以上就介紹了welcome to nginx nginx 開啟 stub_status 模組監控,包括了welcome to nginx方面的內容,希望對PHP教程有興趣的朋友有所協助。