天天看点

nginx 模块nginx_upstream_check_module

我这里用到的nginx为最新版的nginx 所以我使用了最新的插件

nginx_upstream_check_module-master.zip

cd nginx-1.7.1

patch -p1 </tmp/nginx_upstream_check_module-master/check_1.5.12+.patch

nginx -v

./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-ipv6 --add-module=/tmp/nginx_upstream_check_module-master

--add-module=/tmp/nginx_upstream_check_module-master 为我解压文件的路径

配置案例:

upstream cluster {

        # simple round-robin

        server 192.168.15.21:8084;

        server 192.168.15.17:80;

        check interval=3000 rise=2 fall=5 timeout=1000;

    }

server {

        listen       80;

        server_name  localhost;

        location / {

            #root   html;

            #index  index.html index.htm;

           proxy_pass http://cluster;

        }

         location /status {

            check_status;

            access_log   off;

            #allow some.ip.add.ress;

            #deny all;

       }

通过页面http://192.168.15.21/status页面可以看到后端realserver的状态

参数说明:

#interval检测间隔时间,单位为毫秒,rsie请求2次正常的话,标记此realserver的状态为up,fall表示请求5次都失败的情况下,标记此realserver的状态为down,timeout为超时时间,单位为毫秒。

继续阅读