SchiriTrainer2/frontend/nginx.conf
2025-07-25 14:02:35 +02:00

30 lines
713 B
Nginx Configuration File

server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# API wird intern an Express weitergereicht
location ^~ /api/ {
proxy_pass http://schiri-backend:3000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_cache_bypass $http_upgrade;
}
# Alle anderen Requests an index.html (für React-Routing)
location / {
try_files $uri /index.html;
}
# Static Files explizit behandeln (optional)
location ~* \.(?:ico|css|js|gif|jpe?g|png|woff2?|ttf|svg|eot|otf)$ {
expires 6M;
access_log off;
add_header Cache-Control "public";
}
}