Skip to content

HA Proxy VM

Configure HAProxy VM

  1. SSH to HAProxy VM using the VSCode > Terminal

    ssh -l ubuntu <ip-address-of-haproxy-user01-01>
    
    ssh -l ubuntu 10.x.x.123
    
  2. Install HAProxy

    sudo apt update
    sudo apt install -y haproxy
    
  3. Configure HAProxy

    Edit configurations:

    sudo nano /etc/haproxy/haproxy.cfg
    

    Replace or append:

    frontend http_front
        bind *:80
        default_backend web_servers
    
    backend web_servers
        balance roundrobin
        server web1 _your_fe1_server_ip:80 check
        server web2 _your_fe2_server_ip:80 check
    
  4. Enable and Restart HAProxy

    sudo systemctl enable haproxy
    sudo systemctl restart haproxy
    
  5. Verify status:

    sudo systemctl status haproxy
    
    8. Firewall Rules (If Enabled)

    sudo ufw allow 80
    sudo ufw enable
    

Validation

  1. Finish the Wordpress install in Browser

    On any browser, point to your web server’s IP, e.g.:

    http://_your_webserver_ip/wp-admin/install.php
    
  2. Test Load Balancing

    Open a browser to point to your HAProxy VM IP.

    http://<HAPROXY_IP>:8404/stats