I've been working on a basic setup to host a number of sites through docker on a local machine. The theory goes:
Port 80 traffic hits my router and is forwarded to my computer with Docker on it
An nginx docker image handles the request and, based on the domain, routes the request to another docker container with a specified port
The final container serves the response.
Here's how I've set things up.
The nginx folder needs to be created, but will be empty to start. We need, at a minimum the mime.types file and an nginx.conf
The connection between the upstreams, which point to the specific server and port on my network and the servers, which point the domains to the upstreams is key to getting this to work. Because the proxy is listening to port 80 for all traffic, each server will have port 80 as it's listen.
Finally, the docker-compose.yml for my other services will have their upstream port mapped to port 80 (in most cases) which ties the whole thing together.