Fwd: NGINX config for websocket HA failover

Hari Poludasu ihari2004 at gmail.com
Mon May 26 12:21:11 UTC 2014


I would like to use NGINX for failover in my HA setup. I have two VMs
running in Active-Active mode and listening on 9080 port for WebSocket
connections from clients. I would like to use NGINX to route all websocket
traffic to route to VM1 and must route to VM2 only on failure of VM1.

NGINX is running on my windows, If I use the following config, is it enough?

http {

upstream web_rack {

server vm1:9080;

server vm2:9080;


server {

listen 80;

server_name localhost;

location / {

proxy_pass http://web_rack;

proxy_http_version 1.1;

proxy_set_header Upgrade websocket;

proxy_set_header Connection upgrade;




What changes I need to do in config to add the failover mechanism to allow
NGINX to route websocket traffic to vm2 only on vm1 failure?

Thanks and regards,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20140526/d2376bf1/attachment.html>

More information about the nginx mailing list