Oct 18, 2022

Load-Balance with Nginx

Get inspired from the article How to Setup Nginx Reverse Proxy, I would like to challenge these with multipass + cloud-init to load balance for 3 backend servers.

In summary, we will create 4 instances of servers where 1 being the reverse-proxy and load-balancer role, and 3 being the backend web servers.

PS> multipass launch -n backend1 --cloud-init ci_backend1.yaml

PS> multipass launch -n backend2 --cloud-init ci_backend2.yaml

PS> multipass launch -n backend3 --cloud-init ci_backend3.yaml

PS> multipass launch -n lbr --cloud-init ci_lbr.yaml

Then point your browser (at host) to http://lbr.mshome.net/ and keep refresh. 😊

I took less than 8 minutes to start all the 4 instances of servers. All the necessary (4) files are stored at GitHub link below. Below are the screenshots.

 

Backend1 via lbr

Backend2 via lbr

Backend3 via lbr


Links: