Nginx health check module

Recommended for you: Get network issues from WhatsUp Gold. Not end users.
We all know, Some nginx reverse proxy, If the back-end server failure., Nginx is unable to give this RealServer propose upstream, So also have forwards the request to the back end of the RealServer to the above, Although nginx can enable proxy_next_upstream in localtion solution is returned to the user of the error page, Methods in the: , You can refer to, But this will put forward requests to this server, And then forwarded to other servers, Thus wasting a forwarding, The nginx module with nginx_upstream_check_module and Taobao technology team developed to detect rear RealServer health status, If the back-end server is not available, So the request is not forwarded to the server.

Nginx install the health check module
Using version
nginx-1.2.9
Download the patch
https://github.com/yaoweibin/nginx_upstream_check_module

Unzip source code
cd /application/search/tmp/nginx-1.2.9
patch -p1 < /application/search/tmp/nginx_upstream_check_module-0.1.9/check_1.2.6+.patch

./configure \
  --prefix=/application/search/usr/nginx-1.2.9 \
  --with-http_ssl_module \
  --add-module=/application/search/tmp/nginx_upstream_check_module-0.1.9

make && make install

Configuration mode
upstream myserver {
        server 127.0.0.1:81;
        server 127.0.0.1:82;
        check interval=3000 rise=2 fall=1 timeout=1000 type=http;
        #Must be HTTP/1.0
        check_http_send "GET /_.gif HTTP/1.0\r\n\r\n";
        check_http_expect_alive http_2xx http_3xx;
}
Server node configuration
location /load {
        proxy_pass      http://myserver/;
        proxy_redirect  http://myserver//;
        proxy_set_header   Host             $host;
        proxy_set_header        X-Forwarded-For $http_x_forwarded_for;
        proxy_set_header   X-Real-IP        $remote_addr;
        proxy_set_header   REMOTE-HOST      $remote_addr;
}

location /nstatus {
    check_status;
    access_log off;
    #allow SOME.IP.ADD.RESS;
    #deny all;
}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Tess at December 29, 2013 - 8:17 PM