My issue:
I’m trying to reverse proxy Firefly III (running in Docker) using nginx (also in Docker), but I’m getting a 502 Bad Gateway when accessing the app through nginx on port 80. Direct access via the exposed port works fine.
How I encountered the problem:
After deploying Firefly III in Docker, I set up an nginx container to reverse proxy it. Accessing http://my_vps_ip_address:8000 works as expected (this is Firefly directly). But accessing http://my_vps_ip_address (which hits nginx on port 80) results in a 502 error. Both containers are in the same Docker network, and nginx is configured to proxy to http://firefly:8000.
Solutions I’ve tried:
Verified Firefly is running and accessible via my_vps_ip_address:8000
Confirmed that both containers are in the same custom Docker network
Used container name firefly in the nginx proxy_pass directive
Any insights into what might be causing the 502 or how to properly connect nginx to a Docker service on the same network would be greatly appreciated. Thanks!
The most likely problem is a port mismatch between your Nginx configuration and your actual Firefly III container. In your docker-compose.yml, Firefly III exposes port 8080 internally, but your Nginx is trying to connect to port 8000.
If the firefly app is available on my_vps_ip_address:8000, you would want to use that in the proxy_pass directive. I am assuming that NGINX is unable to properly resolve the firefly hostname, which would cause this sort of error.
Thanks for your response. From my understanding, it would be required to use the internal name and not the public ip address because after nginx works, I would like to disable the my_vps_ip_address:8000 port reveal and allow access only using :80 or :443 later on. I’m wondering why the hostname cannot be resolved, I put them in the same network. Also when using the my_vps_ip_address, it results in a 504 Gateway Timeout. Currently I cannot grasp why.
It seems like 8080 would be correct than, that is a good learning. However it still says 502 Bad Gateway when using 8080 despite having http://firefly:8080 in nginx config. I also tried 172.18.0.4:8080 now, this is the internal ip address presented by curl. But this does not work as well unfortunately.
+------------------------------------------------------------------------------+
| |
| Thank you for installing Firefly III, v6.2.12! |
| There are no extra installation instructions. |
| Firefly III should be ready for use. |
| |
| Did you know you can support the development of Firefly III? |
| You can donate in many ways, like GitHub Sponsors or Patreon. |
| For more information, please visit https://bit.ly/donate-to-Firefly-III |
| |
+------------------------------------------------------------------------------+
[01-May-2025 22:48:50] NOTICE: fpm is running, pid 166
[01-May-2025 22:48:50] NOTICE: ready to handle connections
✅ NGINX + PHP-FPM is running correctly.
I used another browser and now I was able to connect. Seems to be working now! So the problem was the resolver resolver 127.0.0.11; I think. Thank you a lot for your help so far!