nginx_upstream_check_module模塊:nginx
*** 下載地址https://github.com/yaoweibin/nginx_upstream_check_module ***git
wget 'http://nginx.org/download/nginx-1.14.0.tar.gz' tar -xzvf nginx-1.14.0.tar.gz cd nginx-1.14.0/ patch -p1 < /path/to/nginx_http_upstream_check_module/check_1.14.0+.patch #./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=/opt/tools/openssl-1.0.2l/ --with-pcre-jit --with-ld-opt=-ljemalloc --with-debug --add-module=/opt/tools/nginx-module-vts-master/ --add-module=/opt/tools/nginx_upstream_check_module-master/ --add-module=/opt/tools/ngx_cache_purge-2.3/ #make #mv objs/nginx /usr/local/nginx/sbin/nginx #nginx -s reload
http { upstream cluster { # simple round-robin server 192.168.0.1:80; server 192.168.0.2:80; check interval=5000 rise=1 fall=3 timeout=4000; #check interval=3000 rise=2 fall=5 timeout=1000 type=ssl_hello; #check interval=3000 rise=2 fall=5 timeout=1000 type=http; #check_http_send "HEAD / HTTP/1.0\r\n\r\n"; #check_http_expect_alive http_2xx http_3xx; } server { listen 80; location / { proxy_pass http://cluster; } location /check_status { check_status; access_log off; allow SOME.IP.ADD.RESS; deny all; } } }