<div dir="ltr"><br><div class="gmail_quote"><br><br><br><div dir="ltr"><p class="MsoNormal">Hi,</p>
<p class="MsoNormal"> </p>
<p style="margin:0in 0in 11.25pt;line-height:15.75pt"><span><span style="font-size:11.5pt;font-family:Arial,sans-serif;color:rgb(63,69,73)">I </span></span><span style="font-size:11.5pt;font-family:Arial,sans-serif;color:rgb(63,69,73)">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.</span></p>
<p style="margin:0in 0in 11.25pt;line-height:15.75pt"><span style="font-size:11.5pt;font-family:Arial,sans-serif;color:rgb(63,69,73)">NGINX is running on my windows,
If I use the following config, is it enough?</span></p>
<p style="margin:0in 0in 11.25pt;line-height:15.75pt"><span style="font-size:11.5pt;font-family:Arial,sans-serif;color:rgb(63,69,73)">http {</span></p>
<p style="margin:0in 0in 11.25pt;line-height:15.75pt"><span style="font-size:11.5pt;font-family:Arial,sans-serif;color:rgb(63,69,73)">upstream web_rack {</span></p>
<p style="margin:0in 0in 11.25pt;line-height:15.75pt"><span style="font-size:11.5pt;font-family:Arial,sans-serif;color:rgb(63,69,73)">server vm1:9080;</span></p>
<p style="margin:0in 0in 11.25pt;line-height:15.75pt"><span style="font-size:11.5pt;font-family:Arial,sans-serif;color:rgb(63,69,73)">server vm2:9080;</span></p>
<p style="margin:0in 0in 11.25pt;line-height:15.75pt"><span style="font-size:11.5pt;font-family:Arial,sans-serif;color:rgb(63,69,73)">}</span></p>
<p style="margin:0in 0in 11.25pt;line-height:15.75pt"><span style="font-size:11.5pt;font-family:Arial,sans-serif;color:rgb(63,69,73)">server {</span></p>
<p style="margin:0in 0in 11.25pt;line-height:15.75pt"><span style="font-size:11.5pt;font-family:Arial,sans-serif;color:rgb(63,69,73)">listen 80;</span></p>
<p style="margin:0in 0in 11.25pt;line-height:15.75pt"><span style="font-size:11.5pt;font-family:Arial,sans-serif;color:rgb(63,69,73)">server_name localhost;</span></p>
<p style="margin:0in 0in 11.25pt;line-height:15.75pt"><span style="font-size:11.5pt;font-family:Arial,sans-serif;color:rgb(63,69,73)">location / {</span></p>
<p style="margin:0in 0in 11.25pt;line-height:15.75pt"><span style="font-size:11.5pt;font-family:Arial,sans-serif;color:rgb(63,69,73)">proxy_pass <a href="http://web_rack" target="_blank">http://web_rack</a>;</span></p>
<p style="margin:0in 0in 11.25pt;line-height:15.75pt"><span style="font-size:11.5pt;font-family:Arial,sans-serif;color:rgb(63,69,73)">proxy_http_version 1.1;</span></p>
<p style="margin:0in 0in 11.25pt;line-height:15.75pt"><span style="font-size:11.5pt;font-family:Arial,sans-serif;color:rgb(63,69,73)">proxy_set_header Upgrade
websocket;</span></p>
<p style="margin:0in 0in 11.25pt;line-height:15.75pt"><span style="font-size:11.5pt;font-family:Arial,sans-serif;color:rgb(63,69,73)">proxy_set_header Connection
upgrade;</span></p>
<p style="margin:0in 0in 11.25pt;line-height:15.75pt"><span style="font-size:11.5pt;font-family:Arial,sans-serif;color:rgb(63,69,73)">}</span></p>
<p style="margin:0in 0in 11.25pt;line-height:15.75pt"><span style="font-size:11.5pt;font-family:Arial,sans-serif;color:rgb(63,69,73)">}</span></p>
<p style="margin:0in 0in 11.25pt;line-height:15.75pt"><span style="font-size:11.5pt;font-family:Arial,sans-serif;color:rgb(63,69,73)">}</span></p>
<p style="margin:0in 0in 0.0001pt;line-height:15.75pt"><span style="font-size:11.5pt;font-family:Arial,sans-serif;color:rgb(63,69,73)">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?</span></p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Thanks and regards,</p>
<p class="MsoNormal">Hari</p></div>
</div><br></div>