43 lines
1.1 KiB
Nginx Configuration File
43 lines
1.1 KiB
Nginx Configuration File
server {
|
||
listen 80;
|
||
server_name _;
|
||
root /usr/share/nginx/html;
|
||
index index.html;
|
||
|
||
gzip on;
|
||
gzip_types text/css application/javascript application/json image/svg+xml;
|
||
gzip_min_length 1024;
|
||
|
||
# Sicherheits-Header (TLS terminiert der Nginx Proxy Manager davor)
|
||
add_header X-Content-Type-Options "nosniff" always;
|
||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
||
|
||
# Gehashte Assets dürfen dauerhaft gecacht werden.
|
||
location /assets/ {
|
||
expires 1y;
|
||
add_header Cache-Control "public, immutable";
|
||
}
|
||
|
||
# Schriften: lokal ausgeliefert, lange cachebar.
|
||
location /fonts/ {
|
||
expires 1y;
|
||
add_header Cache-Control "public, immutable";
|
||
types {
|
||
font/woff2 woff2;
|
||
font/ttf ttf;
|
||
}
|
||
}
|
||
|
||
# index.html nie cachen – sonst sehen Nutzer nach einem Deploy die alte App.
|
||
location = /index.html {
|
||
add_header Cache-Control "no-store, must-revalidate";
|
||
}
|
||
|
||
# SPA-Fallback: /portal, /login usw. existieren nicht als Dateien.
|
||
# Ohne diese Zeile führt ein Reload auf einer Unterseite zu 404.
|
||
location / {
|
||
try_files $uri $uri/ /index.html;
|
||
}
|
||
}
|