veylant/web-public/nginx.conf
2026-03-13 13:16:35 +01:00

30 lines
1019 B
Nginx Configuration File

server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; connect-src 'self' https:;" always;
# Gzip
gzip on;
gzip_vary on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml text/javascript;
# Static assets — long cache
location ~* \.(js|css|png|jpg|jpeg|svg|ico|woff2?)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
# SPA fallback — all routes served by index.html
location / {
try_files $uri $uri/ /index.html;
}
}