如何启用nginx状态页面?

时间:2014-04-29 07:06:20

标签: nginx

我的check_nginx_status Nagios插件需要IP / nginx_status页面。我遵循了一些指示:

nginx -V | grep --color -o http_stub_status #some HttpStubStatusModule verification

在nginx.conf中,我添加了:

http {
...
server{
  location /nginx_status {
    stub_status on;
    access_log   off;
    allow MY_IP;
    deny all;
 }
}
...
}

在nginx重新加载后,页面应该可用。 但是,我得到“您正在寻找的页面不存在。”

我有nginx v1.6.0。

nginx.conf:

user www-data;
worker_processes 4;
pid /run/nginx.pid;

events {
    worker_connections 768;
}

http {
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    gzip on;
    gzip_disable "msie6";

    server {

    listen 80;

    location /nginx_status {
    stub_status on;
    access_log   off;
    #allow 107.170.106.199;
    #deny all;
    }
    }

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}

0 个答案:

没有答案