upstream wukongim_backend { server 192.168.1.10:5001; server 192.168.1.11:5001; server 192.168.1.12:5001;}server { location /health { proxy_pass http://wukongim_backend/health; proxy_connect_timeout 5s; proxy_read_timeout 5s; } location / { proxy_pass http://wukongim_backend; # Health check configuration health_check uri=/health interval=30s fails=3 passes=2; }}
HAProxy Configuration:
Copy
backend wukongim_servers balance roundrobin option httpchk GET /health http-check expect status 200 server wk1 192.168.1.10:5001 check inter 30s server wk2 192.168.1.11:5001 check inter 30s server wk3 192.168.1.12:5001 check inter 30s