This project demonstrates a simple load balancer setup using Nginx and multiple Node.js backend servers, orchestrated with Docker Compose.
nginx.conf: Nginx configuration for load balancingdocker-compose.yaml: Defines Nginx and three Node.js app servicesserver.js: Node.js Express serverindex.html: Frontend pageimages/: Static images
- Build and start the services:
docker-compose up --build - Access the load balancer at http://localhost:8080
- Each request is distributed to one of the backend Node.js apps.
- If you see
502 Bad Gateway, ensure your Nginx config points toapp1:3000,app2:3000,app3:3000. - Check container logs for errors:
docker logs <container_name>
MIT