Skip to content

singh-vinit/nginx_load_balancer

Repository files navigation

Load Balancer with Nginx and Node.js

This project demonstrates a simple load balancer setup using Nginx and multiple Node.js backend servers, orchestrated with Docker Compose.

Structure

  • nginx.conf: Nginx configuration for load balancing
  • docker-compose.yaml: Defines Nginx and three Node.js app services
  • server.js: Node.js Express server
  • index.html: Frontend page
  • images/: Static images

Usage

  1. Build and start the services:
    docker-compose up --build
    
  2. Access the load balancer at http://localhost:8080
  3. Each request is distributed to one of the backend Node.js apps.

Troubleshooting

  • If you see 502 Bad Gateway, ensure your Nginx config points to app1:3000, app2:3000, app3:3000.
  • Check container logs for errors:
    docker logs <container_name>
    

License

MIT

About

nginx load balancer works on round robin algorithm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors