首页 > Linux > 开启Nginx的状态监控页面

开启Nginx的状态监控页面

2010年2月24日 发表评论 阅读评论

第一步:编译Nginx的时候添加参数:--with-http_stub_status_module
例如:

cd nginx-0.8.15/
./configure --user=www --group=www --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module
make && make install

第二步:修改Nginx配置文件nginx.conf
vi /usr/local/webserver/nginx/conf/nginx.conf
在HTTP段中添加

  server
  {
    listen  80;
    server_name  status.a18zhizao.cn;
    location / {                  #主要是这里代表根目录显示信息
    stub_status on;
    access_log   off;
    }
  }

例如:我的配置方法

server
        {
                listen       80;
                server_name a18zhizao.cn www.a18zhizao.cn;
                index index.html index.htm index.php;
                root  /home/wwwroot/a18zhizao;
                include /usr/local/nginx/conf/myblog.conf;
                location ~ .*\.(php|php5)?$
                        {
                                fastcgi_pass  unix:/tmp/php-cgi.sock;
                                #fastcgi_pass  127.0.0.1:9000;
                                fastcgi_index index.php;
                                include fcgi.conf;
                        }

                location /status {
                        stub_status on;             #这里就是我的信息
                        access_log   off;
                }

                location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
                        {
                                expires      30d;
                        }

                location ~ .*\.(js|css)?$
                        {
                                expires      12h;
                        }

                log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '
             '$status $body_bytes_sent "$http_referer" '
             '"$http_user_agent" $http_x_forwarded_for';
                access_log  /home/wwwroot/logs/access.log  access;
        }
分类: Linux 标签: ,
  1. 本文目前尚无任何评论.
  1. 本文目前尚无任何 trackbacks 和 pingbacks.

注意: 评论者允许使用'@user空格'的方式将自己的评论通知另外评论者。例如, ABC是本文的评论者之一,则使用'@ABC '(不包括单引号)将会自动将您的评论发送给ABC。使用'@all ',将会将评论发送给之前所有其它评论者。请务必注意user必须和评论者名相匹配(大小写一致)。直接点击评论上方的回复实现此功能