50 lines
1.6 KiB
Nginx Configuration File
50 lines
1.6 KiB
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
# ------------------------------------------------------------------
|
|
# HTTPS redirect — uncomment after running certbot:
|
|
# listen 443 ssl http2;
|
|
# ssl_certificate /etc/letsencrypt/live/docs.arcline.it/fullchain.pem;
|
|
# ssl_certificate_key /etc/letsencrypt/live/docs.arcline.it/privkey.pem;
|
|
# include /etc/letsencrypt/options-ssl-nginx.conf;
|
|
# add_header Strict-Transport-Security "max-age=63072000" always;
|
|
#
|
|
# And add a redirect block:
|
|
# server { listen 80; server_name _; return 301 https://$host$request_uri; }
|
|
# ------------------------------------------------------------------
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# Custom 404
|
|
error_page 404 /404.html;
|
|
|
|
# robots.txt at root
|
|
location = /robots.txt {
|
|
try_files /robots.txt =404;
|
|
}
|
|
|
|
# Clean URLs: /section/page/ → /section/page/index.html
|
|
location / {
|
|
try_files $uri $uri/ $uri/index.html =404;
|
|
}
|
|
|
|
# Security headers
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
|
|
# Cache static assets aggressively
|
|
location ~* \.(css|js|woff2?|ttf|otf|svg|png|ico|webp|jpg)$ {
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
|
|
# Never cache HTML, JSON, or XML
|
|
location ~* \.(html|json|xml)$ {
|
|
expires -1;
|
|
add_header Cache-Control "no-cache";
|
|
}
|
|
}
|