Files
Cozy-Den/nginx.conf
T
Latte 7fbe9a3e43
CI / ci (push) Successful in 28s
Add Nav, About/Projects pages and nginx hardening
Harden nginx: add CSP, HSTS, Referrer-Policy and Permissions-Policy;
include image/svg+xml in gzip types; set X-Content-Type-Options on
static assets; change try_files to return =404.

Add Nav component and wire into BaseLayout; add About and Projects
pages with projects.json, an initial blog post, and small layout/padding
adjustments (removed redundant back links).
2026-03-04 19:53:13 +01:00

37 lines
1.4 KiB
Nginx Configuration File

server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
absolute_redirect off;
# Gzip compression
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml+rss application/javascript application/json image/svg+xml;
# Security headers
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "DENY" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "camera=(), microphone=(), geolocation=(), interest-cohort=()" always;
add_header Content-Security-Policy "default-src 'none'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self'; font-src 'self'; connect-src 'self'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'" always;
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
# Cache static assets
location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf|eot)$ {
expires 1y;
add_header Cache-Control "public, immutable";
add_header X-Content-Type-Options "nosniff" always;
}
# Main location
location / {
try_files $uri $uri/ =404;
}
# Custom error pages
error_page 404 /404.html;
}