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

Hello,

I have 3 servers and on each server is installed nginx and apache. I
want
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
other
2 servers in case that main server fail totally.

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

  1. On Main server i set upstreas like that:

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

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

server 127.0.0.1:8080; (i set only this and not the others to prevent
loop)

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

Awaiting for your reply.

Thank you in advance.

Best regards,
Ali


Iguana Information Technologies, SL
Calle Lpez de Hoyos 35, 1
28002 Madrid, Espaa (Spain)
+34 915569100
+34 649336286
http://www.iguanait.com/

Advertencia

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