1. 程式人生 > >nginx配置狀態模塊報錯

nginx配置狀態模塊報錯

註意 www. 信息 需要 index page amp 客戶端 ror

[root@web02 nginx-1.6.3]# /application/nginx/sbin/nginx -t

nginx: [emerg] invalid number of arguments in "stub_status" directive in /application/nginx-1.6.3/conf/extra/status.conf:4
nginx: configuration file /application/nginx-1.6.3/conf/nginx.conf test faile

檢查 /application/nginx/sbin/nginx -V

nginx version: nginx/1.6.3

built by gcc 4.4.7 20120313 (Red Hat 4.4.7-23) (GCC)
TLS SNI support enabled
configure arguments: --prefix=/application/nginx-1.6.3 --user=www --group=www --with-http_stub_status_module --with-http_ssl_module

如果沒有 --with-http_stub_status_module 模塊 需要安裝
在對應目錄下執行編譯安裝三部曲
./configure –with-http_stub_status_module

make && make install

[root@web02 extra]# cat www.conf
server {
listen 80;
server_name 對應的域名;
location / {
root html/www;
index index.html index.htm;
}
#這個就是要需要開啟的監控模塊
#註意要在指定的server標簽下加入 就是監控哪個域名
location /nginx_status {
stub_status on;
access_log off;
#加入訪問限制

allow IP地址;

allow IP地址;

deny all

      }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
}

    然後平滑重啟 

    [root@web02 extra]# /application/nginx/sbin/nginx  -s reload

在網址輸入對應的域名
域名/nginx_status
Active connections: 2
server accepts handled requests
74 74 111
Reading: 0 Writing: 1 Waiting: 1

Active connections: 對後端發起的活動連接數.
Server accepts handled requests: Nginx總共處理了74個連接,成功創建74次握手(證明中間沒有失敗的),總共處理了111個請求.
Reading: Nginx 讀取到客戶端的Header信息數.
Writing: Nginx 返回給客戶端的Header信息數.
Waiting: 開啟keep-alive的情況下,這個值等於 active – (reading + writing),意思就是Nginx已經處理完成,正在等候下一次請求指令的駐留連接。

nginx配置狀態模塊報錯