mirror of
https://github.com/MrUnknownDE/utools.git
synced 2026-05-06 22:16:06 +02:00
fix nginx issue in dev env
This commit is contained in:
@@ -11,7 +11,7 @@ WORKDIR /usr/share/nginx/html
|
|||||||
RUN rm /etc/nginx/conf.d/default.conf
|
RUN rm /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
# Kopiere unsere eigene Nginx Konfiguration
|
# Kopiere unsere eigene Nginx Konfiguration
|
||||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
COPY nginx.dev.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
# Kopiere die Frontend-Dateien in das Verzeichnis, das Nginx ausliefert
|
# Kopiere die Frontend-Dateien in das Verzeichnis, das Nginx ausliefert
|
||||||
COPY app/ .
|
COPY app/ .
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
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;
|
||||||
Reference in New Issue
Block a user