58 lines
1.6 KiB
Nginx Configuration File
58 lines
1.6 KiB
Nginx Configuration File
|
|
server {
|
||
|
|
listen 80;
|
||
|
|
server_name _;
|
||
|
|
root /usr/share/nginx/html;
|
||
|
|
index index.html;
|
||
|
|
|
||
|
|
# Sécurité de base
|
||
|
|
add_header X-Content-Type-Options "nosniff" always;
|
||
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
||
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
||
|
|
add_header Permissions-Policy "geolocation=(), microphone=(), camera=()" always;
|
||
|
|
server_tokens off;
|
||
|
|
|
||
|
|
# Compression
|
||
|
|
gzip on;
|
||
|
|
gzip_vary on;
|
||
|
|
gzip_min_length 256;
|
||
|
|
gzip_types text/plain text/css text/xml application/xml application/rss+xml application/javascript application/json image/svg+xml;
|
||
|
|
|
||
|
|
# Cache long pour assets immutables (Astro hash les fichiers)
|
||
|
|
location /_astro/ {
|
||
|
|
expires 1y;
|
||
|
|
add_header Cache-Control "public, immutable";
|
||
|
|
access_log off;
|
||
|
|
}
|
||
|
|
|
||
|
|
# Cache modéré pour images/fonts
|
||
|
|
location ~* \.(?:jpg|jpeg|gif|png|ico|svg|woff2?|ttf)$ {
|
||
|
|
expires 30d;
|
||
|
|
add_header Cache-Control "public";
|
||
|
|
access_log off;
|
||
|
|
}
|
||
|
|
|
||
|
|
# RSS
|
||
|
|
location = /rss.xml {
|
||
|
|
add_header Content-Type "application/rss+xml; charset=utf-8";
|
||
|
|
expires 10m;
|
||
|
|
}
|
||
|
|
|
||
|
|
# Sitemap
|
||
|
|
location = /sitemap-index.xml {
|
||
|
|
add_header Content-Type "application/xml; charset=utf-8";
|
||
|
|
expires 1d;
|
||
|
|
}
|
||
|
|
location = /sitemap-0.xml {
|
||
|
|
add_header Content-Type "application/xml; charset=utf-8";
|
||
|
|
expires 1d;
|
||
|
|
}
|
||
|
|
|
||
|
|
# SPA-style fallback (Astro génère des dossiers index.html, donc try_files suffit)
|
||
|
|
location / {
|
||
|
|
try_files $uri $uri/ $uri.html $uri/index.html =404;
|
||
|
|
}
|
||
|
|
|
||
|
|
# 404 propre
|
||
|
|
error_page 404 /404.html;
|
||
|
|
}
|