参考:https://github.com/yaoweibin/nginx_upstream_check_module
注:要根据之前编译来重新编译。
下载healthcheck_nginx_upstreams:见附件。
unzip nginx_upstream_check_module-master.zip
这里要注意下,用回源nginx-1.2.6包,否则会出错。也就是确定之前没有patch过源包
patch -p1 < ../nginx_upstream_check_module-master/check_1.2.6+.patch
make
make install
service nginx start
vi /etc/nginx/nginx.conf
在负载服务器下加入
check interval=3000 rise=2 fall=5 timeout=1000;
在server中加入
location /status {
check_status;
access_log off;
allow 10.1.230.35;
deny all;
}
service nginx restart
打开http://IP/status
会看到后端服务器的运行状态。