Reverse proxy for local dns resolving

I have a bunch of services running in my home network. The more services I add, the more trouble I have remembering the ports for everything. Running a reverse proxy was something that has been on my planning for a while now but never got to implementing.

That was until last week when I learned about jwilder/nginx-proxy.

TLDR; it auto generates a reverse proxy configuration for nginx based on the running containers in your docker environment. The only thing you have to do is set two environment variables VIRTUAL_HOST and VIRTUAL_PORT on whatever container you like to specify the dns record and port it should forward to.

Example docker-compose.yml config:

What's left for us to do is point our local DNS server to resolve everything ending in .local to our host running the reverse proxy. In my case (and as you can read in my previous post here) I have a dnsmasq server running. To set it up with the reverse proxy I just have to add the following line to my dnsmasq.conf:

This will redirect all domain names ending in .local to the host at IP, which will then get forwarded to the correct IP/container by the jwilder/nginx-proxy container.

That's literally the only thing you have to do. It will generate an internal proxy_pass configuration that will resolve whoami.local to the container whoami 🚀