WFDASHDRIVER-APP/nginx.conf

51 lines
1.6 KiB
Nginx Configuration File
Raw Permalink Normal View History

server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# Gzip compression
gzip on;
gzip_vary on;
gzip_min_length 256;
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/plain text/css text/xml text/javascript application/javascript application/xml+rss application/json image/svg+xml application/manifest+json;
# Cache static app assets (immutable cache-busted files)
location ~* ^/_next/static/ {
expires 1y;
add_header Cache-Control "public, immutable";
add_header X-Content-Type-Options "nosniff" always;
}
# Cache images, fonts, icons
location ~* \.(png|jpg|jpeg|gif|ico|svg|webp|woff|woff2|ttf|eot)$ {
expires 30d;
add_header Cache-Control "public";
}
# Service worker - must not be cached
location = /sw.js {
expires -1;
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate";
add_header X-Content-Type-Options "nosniff" always;
}
# Manifest - light caching
location = /manifest.json {
expires 1h;
add_header Cache-Control "public, must-revalidate";
}
# SPA fallback - handles /, /login/, /map/, /settings/
location / {
try_files $uri $uri/ $uri/index.html /index.html;
}
# Security headers (applied globally)
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "geolocation=(self)" always;
}