docs: add Nginx Proxy Manager configuration guide
- Document reverse proxy setup for API forwarding - Frontend public via HTTPS - Backend internal only via Nginx proxy
This commit is contained in:
@@ -0,0 +1,121 @@
|
||||
# Nginx Proxy Manager Konfiguration für WrestleDesk
|
||||
|
||||
Diese Anleitung beschreibt die Einrichtung von Nginx Proxy Manager, damit das Frontend öffentlich erreichbar ist, das Backend aber intern bleibt.
|
||||
|
||||
## Architektur
|
||||
|
||||
```
|
||||
Internet
|
||||
↓ (HTTPS)
|
||||
rce.playman.top (Nginx Proxy Manager)
|
||||
├── / → 192.168.101.42:10001 (Frontend)
|
||||
└── /api/v1 → 192.168.101.42:10002 (Backend intern)
|
||||
```
|
||||
|
||||
## Schritt 1: Proxy Host für Frontend erstellen
|
||||
|
||||
1. Nginx Proxy Manager öffnen (http://deine-unraid-ip:81)
|
||||
2. **Proxy Hosts** → **Add Proxy Host**
|
||||
|
||||
**Details Tab:**
|
||||
- **Domain Names:** `rce.playman.top`
|
||||
- **Scheme:** `http`
|
||||
- **Forward Hostname / IP:** `192.168.101.42`
|
||||
- **Forward Port:** `10001`
|
||||
- **Cache Assets:** ❌ (optional)
|
||||
- **Block Common Exploits:** ✅ (empfohlen)
|
||||
|
||||
**SSL Tab:**
|
||||
- **SSL Certificate:** `Request a new SSL Certificate`
|
||||
- **Force SSL:** ✅
|
||||
- **HTTP/2 Support:** ✅
|
||||
- **Accept Terms:** ✅
|
||||
- **Save**
|
||||
|
||||
## Schritt 2: API Weiterleitung (Location) hinzufügen
|
||||
|
||||
1. Auf den gerade erstellten Host klicken (**Edit**)
|
||||
2. **Advanced** Tab öffnen
|
||||
|
||||
**Custom Locations einfügen:**
|
||||
|
||||
```nginx
|
||||
location /api/v1 {
|
||||
proxy_pass http://192.168.101.42:10002/api/v1;
|
||||
proxy_http_version 1.1;
|
||||
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# CORS Headers für API
|
||||
add_header 'Access-Control-Allow-Origin' 'https://rce.playman.top' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, PATCH, DELETE, OPTIONS' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type' always;
|
||||
|
||||
# Preflight Requests
|
||||
if ($request_method = 'OPTIONS') {
|
||||
return 204;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
3. **Save**
|
||||
|
||||
## Schritt 3: DNS einrichten
|
||||
|
||||
In deinem Domain-Provider:
|
||||
- **Type:** A
|
||||
- **Name:** `rce` (oder @ für Root)
|
||||
- **Value:** `192.168.101.42` (deine Unraid IP)
|
||||
- **TTL:** 300
|
||||
|
||||
## Schritt 4: Testen
|
||||
|
||||
Warte 1-2 Minuten für DNS, dann teste:
|
||||
|
||||
```bash
|
||||
# Frontend erreichbar?
|
||||
curl https://rce.playman.top
|
||||
|
||||
# API erreichbar?
|
||||
curl https://rce.playman.top/api/v1/
|
||||
# Sollte zurückgeben: {"detail":"Authentication credentials were not provided."}
|
||||
```
|
||||
|
||||
## Sicherheitshinweise
|
||||
|
||||
1. **Backend Port 10002** ist nur intern erreichbar (Unraid Firewall)
|
||||
2. **Niemals** Port 10002 im Router öffnen!
|
||||
3. Nur Port 80 und 443 (für Nginx Proxy Manager) sollten vom Internet erreichbar sein
|
||||
|
||||
## Fehlerbehebung
|
||||
|
||||
### "Mixed Content" Fehler im Browser
|
||||
- Prüfe ob SSL aktiv ist (https://)
|
||||
- Frontend .env.local muss `https://` enthalten
|
||||
|
||||
### CORS Fehler
|
||||
- Custom Locations müssen korrekt sein
|
||||
- Backend CORS_ALLOWED_ORIGINS muss `https://rce.playman.top` enthalten
|
||||
|
||||
### API nicht erreichbar
|
||||
```bash
|
||||
# Teste direkten Backend-Zugriff (nur intern)
|
||||
curl http://192.168.101.42:10002/api/v1/
|
||||
|
||||
# Teste über Proxy
|
||||
curl https://rce.playman.top/api/v1/
|
||||
```
|
||||
|
||||
## Wichtige Ports
|
||||
|
||||
| Port | Service | Öffentlich | Intern |
|
||||
|------|---------|------------|--------|
|
||||
| 80 | Nginx HTTP | ✅ | ✅ |
|
||||
| 443 | Nginx HTTPS | ✅ | ✅ |
|
||||
| 10001 | Frontend | ❌ | ✅ |
|
||||
| 10002 | Backend | ❌ | ✅ |
|
||||
|
||||
**Backend ist NUR über Nginx Proxy erreichbar, niemals direkt!**
|
||||
Reference in New Issue
Block a user