Advertisement
kwabenasapong

Untitled

Dec 20th, 2022
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.47 KB | None | 0 0
  1. #!/usr/bin/env bash
  2. # Install and configure HAproxy on your lb-01 server
  3. sudo apt update -y
  4. sudo apt install haproxy -y
  5. echo "frontend main
  6.        bind *:80
  7.        mode http
  8.        default_backend servers
  9.  
  10. backend servers
  11.        balance roundrobin
  12.        server web-01 34.232.68.81:80 check
  13.        server web-02 54.198.29.36:80 check
  14. " | sudo tee -a /etc/haproxy/haproxy.cfg
  15.  
  16. echo "ENABLED=1" | sudo tee -a /etc/default/haproxy
  17. sudo systemctl restart haproxy
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement