Cybersecurity-Projects/PROJECTS/beginner/canary-token-generator/infra/nginx/prod.nginx

55 lines
1.5 KiB
Nginx Configuration File

# =============================================================================
# ©AngelaMos | 2026
# prod.nginx
# =============================================================================
# Production server block: serves built static files
# Note: SSL handled by Cloudflare, not here
server {
listen 80;
listen [::]:80;
server_name _;
root /usr/share/nginx/html;
index index.html;
access_log /var/log/nginx/access.log main_timed buffer=32k flush=5s;
error_log /var/log/nginx/error.log warn;
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 Permissions-Policy "geolocation=(), microphone=(), camera=()" always;
location /health {
access_log off;
return 200 "healthy\n";
add_header Content-Type text/plain;
}
location /assets/ {
expires 1y;
add_header Cache-Control "public, immutable";
access_log off;
try_files $uri =404;
}
location ~* \.(jpg|jpeg|png|gif|ico|svg|webp|avif|woff|woff2|ttf|eot|otf)$ {
expires 1y;
add_header Cache-Control "public, immutable";
access_log off;
}
location / {
add_header Cache-Control "no-cache, must-revalidate";
try_files $uri $uri/ /index.html;
}
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
}