tane/site/nginx.conf

34 lines
1.4 KiB
Nginx Configuration File

server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Security headers. The page is fully static and self-contained: inline CSS
# (needs style-src 'unsafe-inline'), same-origin images (+ data: URIs), no
# third-party scripts. HSTS is host-scoped (no includeSubDomains) so it can't
# affect sibling *.comunes.org sites. TLS is terminated upstream (assange).
add_header Content-Security-Policy "default-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; script-src 'self'; font-src 'self'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header X-Frame-Options "DENY" always;
add_header Permissions-Policy "geolocation=(), camera=(), microphone=(), interest-cohort=()" always;
add_header Strict-Transport-Security "max-age=15768000" always;
# Hugo emits directory-style URLs (/legal/privacy/index.html).
location / {
try_files $uri $uri/ =404;
}
# Long-cache fingerprinted assets and images; the HTML stays fresh.
location ~* \.(png|jpg|jpeg|svg|webp|woff2?|css|js)$ {
expires 7d;
add_header Cache-Control "public";
}
error_page 404 /404.html;
gzip on;
gzip_types text/css application/javascript image/svg+xml application/xml;
gzip_min_length 512;
}