new nginx config

This commit is contained in:
MarcWieland 2025-07-25 01:55:25 +02:00
parent 49820a3665
commit 6d2970eae2

View File

@ -5,13 +5,8 @@ server {
root /usr/share/nginx/html; root /usr/share/nginx/html;
index index.html; index index.html;
# App-Route # API wird intern an Express weitergereicht
location / { location ^~ /api/ {
try_files $uri /index.html;
}
# API Intern weiterleiten an Express
location /api/ {
proxy_pass http://backend:3000/; proxy_pass http://backend:3000/;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
@ -20,7 +15,12 @@ server {
proxy_cache_bypass $http_upgrade; proxy_cache_bypass $http_upgrade;
} }
# Static Files # 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)$ { location ~* \.(?:ico|css|js|gif|jpe?g|png|woff2?|ttf|svg|eot|otf)$ {
expires 6M; expires 6M;
access_log off; access_log off;