I have Nginx Proxy Manager and Grimmory on a shared Docker network, with the database on a separate network. The proxy has a certificate for the subdomain, but I can't get it to reach Grimmory unless I publish the app port on the host. What should I check?
How do I route traffic from Nginx Proxy Manager to a container without publishing its port?
Answers
You shouldn't need a host port mapping for Grimmory. Keep Nginx Proxy Manager and Grimmory on the same user-defined network, remove Grimmory's ports mapping, and set the proxy host's forward hostname to grimmory and forward port to 6060. Use the app's Docker service name if it's different.
The app can still join its own stack network to reach the database. The database doesn't need to join the proxy network. Nginx Proxy Manager publishes ports 80 and 443 for web traffic, while the app port stays on the Docker network.
Reply to this answer
Check what address the application is listening on inside its container. Binding to 0.0.0.0 there is different from publishing a port on 0.0.0.0 on the host. If the app only listens on 127.0.0.1 inside the container, the proxy container won't be able to reach it over the shared network.
Inspect the listening sockets inside the app container if it has a tool such as ss available. Then test the app's service name and internal port from the proxy container or another container on the same network. That separates an app connectivity problem from a proxy configuration problem.
_a81~clampfob.5:
That distinction helps. I'll check the listener inside the container and test the network path before changing the proxy setup again.
Reply to this answer
Have a look at the proxy's access and error logs too. If the request reaches the proxy, the error log can give you a clue whether it's failing to resolve the app name or connect to its port.
For troubleshooting, an app container IP can be a useful temporary test. I'd use the Docker service name for the actual configuration rather than relying on an address that may change when the container is recreated.
Reply to this answer
If the manager keeps getting in your way, plain nginx is an option, especially if you're already comfortable with it. Caddy is another alternative to consider, though switching proxies won't fix an app that isn't reachable on the Docker network.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Jelmar.7v:
Make sure 6060 is the port Grimmory listens on inside the container, not just a host port from an old mapping.