Nginx添加状态监控模块

nginx添加状态监控模块


    wget https://codeload.github.com/yaoweibin/nginx_upstream_check_module/zip/master
    unzip master
    cd nginx-1.6.3
    patch -p1 < ../nginx_upstream_check_module-master/check_1.5.12+.patch
    pkill nginx
    ./configure --prefix=/application/nginx-1.6.3 --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module --add-module=../nginx_upstream_check_module-master/
    make
    mv /application/nginx/sbin/nginx{,.ori}
    cp ./objs/nginx /application/nginx/sbin/
    /application/nginx/sbin/nginx -V
    /application/nginx/sbin/nginx

    [root@lb01 nginx-1.6.3]# cat /application/nginx/conf/nginx.conf
    worker_processes  1;
    events {
        worker_connections  1024;
    }
    http {
        include       mime.types;
        default_type  application/octet-stream;
        sendfile        on;
        keepalive_timeout  65;
    #upload server
    upstream android_pools {
             server 10.0.0.8:80  weight=1;
          check interval=3000 rise=2 fall=5 timeout=1000 type=http;
        }
    upstream pc_pools {
             server 10.0.0.8:8080  weight=1;
     check interval=3000 rise=2 fall=5 timeout=1000 type=http;
       }
    #static
    upstream iphone_pools {
             server 10.0.0.7:80  weight=1;
     check interval=3000 rise=2 fall=5 timeout=1000 type=http;
    }
        server {
            listen       80;
            server_name  www.etiantian.org;
            location / {
            if ($http_user_agent ~* "android")
              {
                proxy_pass http://android_pools;
              }
            if ($http_user_agent ~* "iphone")
              {
                proxy_pass http://iphone_pools;
                }
            proxy_pass http://pc_pools;
            include proxy.conf;
           }
            location /status {
                check_status;
                access_log off;
            }

        }
    }

添加新评论