OpusBike/nginx.conf

40 lines
1.0 KiB
Nginx Configuration File

server {
listen 8080;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Gzip compression
gzip on;
gzip_vary on;
gzip_min_length 256;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml text/javascript image/svg+xml;
# Security headers
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;
# Cache static assets
location ~* \.(css|js|png|svg|json|ico)$ {
expires 1h;
add_header Cache-Control "public, immutable";
}
# Service worker — no caching
location = /js/sw.js {
expires off;
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
# Manifest
location = /manifest.json {
add_header Content-Type "application/manifest+json";
}
# SPA fallback
location / {
try_files $uri $uri/ /index.html;
}
}