====== Generalidades ====== ===== Referencias ===== * https://www.digitalocean.com/community/tutorials/an-introduction-to-haproxy-and-load-balancing-concepts ====== haproxy ====== ===== Comandos ===== apt install haproxy systemctl restart haproxy systemctl status haproxy haproxy -c -f /etc/haproxy/haproxy.cfg tail -f /var/log/haproxy.log cp haproxy.cfg haproxy.cfg.orig ===== Archivos ===== /etc/haproxy/haproxy.cfg ===== Opciones ===== mode tcp option tcplog frontend www bind 192.168.0.210:80 default_backend nginx-backend backend nginx-backend balance roundrobin mode tcp server nginx-1 172.16.0.106:80 check server nginx-1 172.16.0.112:80 check ===== Referencias ===== * https://www.digitalocean.com/community/tutorials/an-introduction-to-haproxy-and-load-balancing-concepts * https://www.digitalocean.com/community/tutorials/how-to-use-haproxy-as-a-layer-4-load-balancer-for-wordpress-application-servers-on-ubuntu-14-04 * https://www.haproxy.com/blog/haproxy-log-customization/ ====== nginx ====== ===== Comandos ===== apt install nginx-light systemctl restart nginx systemctl status nginx ===== Archivos ===== /etc/nginx/sites-enabled/default ===== Opciones ===== upstream backend { # ip_hash; server 172.16.0.106 max_fails=3 fail_timeout=15s weight=1; server 172.16.0.112 max_fails=3 fail_timeout=15s weight=1; server 172.16.0.113 max_fails=3 fail_timeout=15s weight=1 down; } server { listen 80 default_server; listen [::]:80 default_server; //... location / { proxy_pass http://backend; try_files $uri $uri/ =404; } } ===== Referencias ===== * https://www.digitalocean.com/community/tutorials/an-introduction-to-haproxy-and-load-balancing-concepts * https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-load-balancing * https://www.nginx.com/blog/tcp-load-balancing-udp-load-balancing-nginx-tips-tricks/