Created
May 4, 2016 22:57
-
-
Save mbaez/baec4d40c3a024179fa43ea99f8f57d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:80> | |
ServerName balanceador | |
# Actuamos como reverse proxy, apareciendo a los clientes | |
# como un servidor web corriente. | |
ProxyRequests Off | |
# Acceso sin restringir. | |
<Proxy *> | |
Order deny,allow | |
Allow from all | |
</Proxy> | |
# El recurso balancer-manager será el único servido localmente. | |
# El resto, lo pasaremos a balancer://mycluster/, que veremos | |
# se trata del recurso de balanceo formado por los backends. | |
ProxyPass /balancer-manager ! | |
ProxyPass / balancer://prog-web/ nofailover=On | |
# Reescbirimos la URL en las cabeceras HTTP Location, | |
# Content-Location y URI para que en lugar de los requests | |
# locales (frontend), figuren como remotos (backends). | |
ProxyPassReverse / http://nodo1:8080/ | |
ProxyPassReverse / http://nodo2:8080/ | |
ProxyPassReverse / http://nodo3:8080/ | |
ProxyPassReverse / http://nodo4:8080/ | |
# Añadimos miembros (backends) al grupo de balanceo y definimos | |
# el método del mismo. | |
<Proxy balancer://prog-web> | |
BalancerMember http://nodo1:8080 | |
BalancerMember http://nodo2:8080 | |
BalancerMember http://nodo3:8080 | |
BalancerMember http://nodo4:8080 | |
# En este caso, balancemos por número de requests (Round Robin). | |
ProxySet lbmethod=byrequests | |
#ProxySet lbmethod=bytraffic | |
</Proxy> | |
# Habilitamos la interfaz web de management del | |
# balanceador. Convendría restringir acceso y protegerlo con | |
# contraseña. | |
<Location /balancer-manager> | |
SetHandler balancer-manager | |
Order deny,allow | |
Allow from all | |
</Location> | |
</VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment