Files
homelab-docs/troubleshooting/bad-gateway-gitea.md
T

1.4 KiB

Gitea Bad Gateway Error

Problem

After creating a proxy host for Gitea in Nginx Proxy Manager, visiting:

https://git.casko.dev

resulted in:

502 Bad Gateway

Environment

  • Hetzner Cloud Server
  • Ubuntu 24.04
  • Docker
  • Gitea
  • Nginx Proxy Manager

Cause

Nginx Proxy Manager could not communicate with the Gitea container.

The proxy host was configured to forward traffic to:

95.216.204.54:3000

Instead of the Docker container name.

Containers on the same Docker network should communicate using container names, not the server's public IP address.

Investigation

Verified Gitea was running:

docker ps

Verified Gitea was accessible directly:

http://95.216.204.54:3000

Nginx Proxy Manager still returned a 502 error.

Fix

Updated the proxy host settings.

Before

Forward Hostname:

95.216.204.54

Forward Port:

3000

After

Forward Hostname:

gitea

Forward Port:

3000

Saved the proxy host configuration.

Result

The proxy host immediately began working.

The following URL became accessible:

https://git.casko.dev

SSL certificates continued functioning correctly.

Lessons Learned

When Docker containers share a network:

  • Use container names
  • Avoid public IP addresses
  • Verify container names with:
docker ps

Docker's internal DNS automatically resolves container names.