Load balancing between 3 servers where nginx and apache installed on each of them


I have 3 servers and on each server is installed nginx and apache. I
to set these 3 servers load balance each other. One of them will be main
server that will accept the traffic from clients and balance to the
other 2
servers. I have a failover ip that can be switched at any time to the
2 servers in case that main server fail totally.

So I have a question about nginx configuration related to upstreams
Should I proceed that way:

  1. On Main server i set upstreas like that:

server; (this is apache installed on same machine)
server server2; (this is second server, on it on port 80 listens
server server3 backup; (this is third server, on it on port 80 listens

  1. On second and third servers i set only 1 upstream:

server; (i set only this and not the others to prevent

Is this correct way to do it or there is a better way?

Awaiting for your reply.

Thank you in advance.

Best regards,

Iguana Information Technologies, SL
Calle Lpez de Hoyos 35, 1
28002 Madrid, Espaa (Spain)
+34 915569100
+34 649336286


Este mensaje contiene informacin privada y confidencial. Si usted
no es el destinatario, no est autorizado a leer, imprimir, retener,
copiar o difundir este mensaje o parte de l. En caso de que usted
reciba este mensaje por error debe borrarlo. Gracias.

Confidentiality notice