mirror of
https://github.com/MrUnknownDE/utools.git
synced 2026-04-06 00:32:04 +02:00
42 lines
1.4 KiB
Plaintext
42 lines
1.4 KiB
Plaintext
server {
|
|
listen 80;
|
|
server_name localhost; # Oder deine Domain
|
|
|
|
# Root-Verzeichnis für statische Dateien
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# Logging (optional, aber nützlich)
|
|
access_log /var/log/nginx/access.log;
|
|
error_log /var/log/nginx/error.log;
|
|
|
|
# Statische Dateien direkt ausliefern
|
|
location / {
|
|
try_files $uri $uri/ /index.html; # Wichtig für Single-Page-Apps (auch wenn wir keine sind)
|
|
}
|
|
|
|
# API-Anfragen an den Backend-Service weiterleiten
|
|
location /api/ {
|
|
# Der Name 'backend' muss dem Service-Namen in docker-compose.yml entsprechen
|
|
proxy_pass http://backend-dev:3000; # Leitet an den Backend-Container auf Port 3000 weiter
|
|
|
|
# Wichtige Proxy-Header setzen
|
|
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;
|
|
|
|
# Header für Server-Sent Events (Traceroute)
|
|
proxy_set_header Connection '';
|
|
proxy_http_version 1.1;
|
|
proxy_buffering off; # Wichtig für Streaming
|
|
proxy_cache off; # Wichtig für Streaming
|
|
proxy_read_timeout 300s; # Längerer Timeout für potenziell lange Traceroutes
|
|
}
|
|
}
|
|
|
|
# Upstream-Definition (optional, aber sauberer für proxy_pass)
|
|
# upstream backend_server {
|
|
# server backend:3000;
|
|
# }
|
|
# Dann in location /api/: proxy_pass http://backend_server; |