Load Balancing Recipe
This recipe demonstrates how you can use Nginx as a reverse proxy server and load balance between multiple Echo servers.
How to setup Nginx proxy server with Echo? 🔗
Step 1: Install Nginx 🔗
Step 2: Configure Nginx 🔗
Create a file
/etc/nginx/sites-enabled/localhost with the following content:
Change listen, server_name, access_log per your need.
Step 3: Restart Nginx 🔗
service nginx restart
Step 4: Start upstream servers 🔗
go run server.go server1 :8081
go run server.go server2 :8082
Step 5: Browse to https://localhost:8080 🔗
You should see a webpage being served from “server 1” or “server 2”.
Hello from upstream server server1