Jellyfin behind Nginx and Cloudflare in Docker returns 502 connection refused

A home server operator runs Jellyfin, Nginx, and a all as to expose their at a domain like media.mydomain.cc. The correctly forwards requests to Nginx, but Nginx fails to reach Jellyfin, returning a 502 Bad Gateway with a connection-refused error. The logs show Nginx trying to connect to 172.29.0.2:8086 and failing.

Meanwhile, curling Jellyfin directly via the , or browsing to the NAS host IP on port 8096, both work fine. So the service itself is healthy — only the path through Nginx is broken.

Key points

  • Jellyfin, Nginx, and a are all running as
  • Nginx returns 502 with connection refused when proxying to Jellyfin
  • Error logs show Nginx targeting 172.29.0.2:8086
  • Direct access via or host IP:8096 works fine
  • Likely cause: Nginx config port doesn't match Jellyfin's actual listening port
Read original