ngix_http_stub_status_module

1.ngx_http_stub_status_module 是一個 nginx 的內置 http 模塊,該模塊可以提供 nginx 的狀態信息。默認情況下這個模塊是不被編譯進來的,所以在編譯 nginx 時要指定加載該模塊–with-http_stub_status_module

2.首先檢查nginx是否安裝ngx_http_stub_status_module模塊

如果沒有安裝,需要重新編譯。

# nginx? -V | grep http_stub???

ngx_http_stub_status_module (static)

# nginx?? -v

Tengine version: Tengine/2.1.1 (nginx/1.6.2)

?

3,首先在nginx的server段配置對應的信息

server {

??? listen? 80;

??? server_name ?xxx;

??? location /ngx_status ? 自定義模塊名稱

??? {

??????? stub_status on; 開啟狀態訪問

??????? access_log off;

    #allow all;? ?可以設置需要那些主機訪問

    #deny all;

??? }

}

4,重新加載nginx,訪問測試

# service nginx reload

?

curl 127.0.0.1:80/ngx_status

Active connections: 135 ?

server accepts handled requests request_time

?13711907 25715823 5175039843

Reading: 0 Writing: 12 Waiting: 123

說明:

Active connections: 135 ?#//正在活躍的連接數

server accepts handled requests ?

13711907 25715823 5175039843 ? ? ? ? ?#處理了13711907次連接,創建25715823次握手,共5175039843請求。

Reading: 0 Writing: 1 Waiting: 1 ? ? ? ? ?# Reading:讀取客戶端header數,Writing:返回客戶端header數,Waiting:請求完成,等待下一次連接。

 <br/>

? 版權聲明
THE END
喜歡就支持一下吧
點贊11 分享