A practical Docker Compose project for learning how to set up NGINX as a reverse proxy, load balancer, and support for multiple domains under a single IP address.
This project demonstrates a basic infrastructure setup using:
- NGINX for reverse proxy and load balancing
- Docker Compose to orchestrate multiple services
- Multiple domain support (e.g., site1.localhost.com, site2.localhost.com)
- PHP-FPM support for PHP-based web applications
The goal is to provide a simple yet functional environment to study:
- Reverse proxy configuration
- Load balancing between containers
- Hosting multiple domains on one IP
- Forwarding real client IPs from NGINX to containers
β οΈ This is not production-ready. Itβs built for study and experimentation.
You need to point the following addresses to the IP of your host machine.
If you're running Docker locally, use localhost
as the IP.
127.0.0.1 localhost
::1 localhost
192.168.70.10 site3.localhost.com
192.168.70.10 site2.localhost.com
192.168.70.10 site1.localhost.com
- Clone the repository:
git clone https://github.com/abd0hrz/docker-compose-nginx-loadbalance-multiple-domains.git
cd nginx-multi-domain-lb
- Start the containers:
docker-compose up -d
- Visit your domains in the browser: