1.修改nginx.conf配置文件,在http大括号中添加如下配置

 upstream nginx {
     server 192.168.2.140:8080;
     server 192.168.2.136:8080;
     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;
 }


2.在http中的server中添加如下配置

 location /status{
     check_status;
     access_log off;
  }


3.重新启动nginx

 service nginx restart


4.参考官方链接

http://tengine.taobao.org/document/http_upstream_check.html

QQ截图20181015155423.png