Add troubleshooting/bad-gateway-gitea.md
This commit is contained in:
@@ -0,0 +1,113 @@
|
|||||||
|
# Gitea Bad Gateway Error
|
||||||
|
|
||||||
|
## Problem
|
||||||
|
|
||||||
|
After creating a proxy host for Gitea in Nginx Proxy Manager, visiting:
|
||||||
|
|
||||||
|
```text
|
||||||
|
https://git.casko.dev
|
||||||
|
```
|
||||||
|
|
||||||
|
resulted in:
|
||||||
|
|
||||||
|
```text
|
||||||
|
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:
|
||||||
|
|
||||||
|
```text
|
||||||
|
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:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker ps
|
||||||
|
```
|
||||||
|
|
||||||
|
Verified Gitea was accessible directly:
|
||||||
|
|
||||||
|
```text
|
||||||
|
http://95.216.204.54:3000
|
||||||
|
```
|
||||||
|
|
||||||
|
Nginx Proxy Manager still returned a 502 error.
|
||||||
|
|
||||||
|
## Fix
|
||||||
|
|
||||||
|
Updated the proxy host settings.
|
||||||
|
|
||||||
|
### Before
|
||||||
|
|
||||||
|
Forward Hostname:
|
||||||
|
|
||||||
|
```text
|
||||||
|
95.216.204.54
|
||||||
|
```
|
||||||
|
|
||||||
|
Forward Port:
|
||||||
|
|
||||||
|
```text
|
||||||
|
3000
|
||||||
|
```
|
||||||
|
|
||||||
|
### After
|
||||||
|
|
||||||
|
Forward Hostname:
|
||||||
|
|
||||||
|
```text
|
||||||
|
gitea
|
||||||
|
```
|
||||||
|
|
||||||
|
Forward Port:
|
||||||
|
|
||||||
|
```text
|
||||||
|
3000
|
||||||
|
```
|
||||||
|
|
||||||
|
Saved the proxy host configuration.
|
||||||
|
|
||||||
|
## Result
|
||||||
|
|
||||||
|
The proxy host immediately began working.
|
||||||
|
|
||||||
|
The following URL became accessible:
|
||||||
|
|
||||||
|
```text
|
||||||
|
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:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker ps
|
||||||
|
```
|
||||||
|
|
||||||
|
Docker's internal DNS automatically resolves container names.
|
||||||
Reference in New Issue
Block a user