西崑雲這篇文章主要介紹了nginx status狀態頁配置方法和中文說明,重點在配置例子和status的中文說明,需要的朋友可以參考下
nginx和php-fpm一樣內建了一個狀態頁,對於想了解nginx的狀態以及監控nginx非常有幫助。為了後續的監控,我們需要先了解nginx狀態頁是怎麼回事。
1. 啟用nginx status配置
在默認主機裡面加上location或者你希望能訪問到的主機裡面。
複製代碼代碼如下:
server {
listen *:80 default_server;
server_name _;
location /ngx_status
{
stub_status on;
access_log off;
#allow 127.0.0.1;
#deny all;
}
}
2. 重啟nginx
請依照你的環境重啟你的nginx
複製代碼代碼如下:
# service nginx restart
3. 打開status頁面
複製代碼代碼如下:
# curl http://127.0.0.1/ngx_status
Active connections: 11921
server accepts handled requests
11989 11989 11991
Reading: 0 Writing: 7 Waiting: 42
4. nginx status詳解
複製代碼代碼如下:
active connections – 活躍的連接數量
server accepts handled requests — 總共處理了11989個連接 , 成功創建11989次握手, 總共處理了11991個請求
reading — 讀取客戶端的連接數.
writing — 響應數據到客戶端的數量
waiting — 開啟 keep-alive 的情況下,這個值等於 active – (reading+writing), 意思就是 Nginx 已經處理完正在等候下一次請求指令的駐留連接.
特別聲明:以上內容(如有圖片或視頻亦包括在內)為自媒體平臺「網易號」用戶上傳並發布,本平臺僅提供信息存儲服務。
Notice: The content above (including the pictures and videos if any) is uploaded and posted by a user of NetEase Hao, which is a social media platform and only provides information storage services.