It's all very good to load balance the servers, but if the server providing the load balancing was to fall over, neither of the other two servers would be accessible.
One way to resolve that is to set up an HA arrangement so that if the load balancer was to drop out, another server would immediately take it's place.
To provide the HA you can use a service like keepalived which uses the VRRP protocol to provide a highly available Internet Address. In fact, it works very well. A configuration similar to the following would work.
Lets say you want a service to be visible at 10.10.10.100
Create 2 machines with one with IP 10.10.10.101 and the other with IP 10.10.10.102
Install keepalived service on both.
Remember to set: net.ipv4.ip_nonlocal_bind = 1
In sysctl.conf on both machines.
Set up with nginx config as described.
First Nodes keepalived.conf:
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 51
priority 150
advert_int 1
authentication {
auth_type PASS
auth_pass secretpass
}
virtual_ipaddress {
10.10.10.100
}
}
Second Node:
vrrp_instance VI_1 {
state BACKUP
interface eth0
virtual_router_id 51
priority 150
advert_int 1
authentication {
auth_type PASS
auth_pass secretpass
}
virtual_ipaddress {
10.10.10.100
}
}
Now what'll happen is when the master machine is running, it will provide the virtual ip 10.10.10.100
If you stop this machine, the other will take over the IP.
Fuller example: Simple keepalived failover setup on Ubuntu 14.04