I'm trying to update my Nginx reverse proxy configurations to point to my Docker containers using their names and ports. I have one setup that's working fine, but another one isn't. Here's the working example: when I go to bookstack.domain.com, it directs to http://bookstack:8080 and loads the log-in screen perfectly. However, when I try to visit bentopdf.domain.com, I get a "502 Bad Gateway" error instead. Both 'bookstack' and 'bentopdf' are container names. What could I be missing?
4 Answers
It's hard to pinpoint the issue without more details. What services are running in the bentopdf container? Is there something actively listening on port 8080? Have you checked the logs for any clues?
Running both containers on port 8080 internally is totally fine. The reverse proxy handles the incoming traffic and you don’t always need to expose those ports externally unless required. Just ensure that your Nginx config is set up correctly.
Is bentopdf in the same network as Nginx? If they're not on the same Docker network, Nginx won't be able to find bentopdf. That could definitely lead to the errors you're seeing.
Check if the bentopdf container is on the same virtual network as your Nginx container. If it's not, Nginx won't be able to reach it. Once I associated bentopdf with the right network, my issue was resolved. It was just on the default bridge before, but after moving it, everything worked smoothly!

Related Questions
Keep Your Screen Awake Tool
Favicon Generator
JWT Token Decoder and Viewer
Ethernet Signal Loss Calculator
Glassmorphism CSS Generator with Live Preview
Remove Duplicate Items From List