I'm trying to set-up a simple Caddy server on host machine to redirect multiple domains to multiple web servers hosted in Docker containers.
This configuration tells Caddy to proxy all requests for each domain to a different Docker container running on the host machine.
example1.com {
reverse_proxy / http://localhost:8000
}
example2.com {
reverse_proxy / http://localhost:8001
}
exampleN.com { ... }
docker run -d --name web-container1 -p 8000:80 web-image1
docker run -d --name web-container2 -p 8001:80 web-image2
docker run -d --name web-containerN -p 800N:80 web-imageN
What are some more scalable solutions for managing multiple websites and containers when mapping ports to container ports becomes impractical as the number of websites and containers grows?