32 lines
777 B
Nginx Configuration File
32 lines
777 B
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# HTML : jamais caché
|
|
location ~* \.html$ {
|
|
add_header Cache-Control "no-store";
|
|
}
|
|
|
|
# Fichiers Astro avec hash dans _astro/ : cache long immutable
|
|
location ~* ^/_astro/ {
|
|
add_header Cache-Control "public, max-age=31536000, immutable";
|
|
}
|
|
|
|
# CSS / JS sans hash (style.css, main.js) : revalidation
|
|
location ~* \.(css|js)$ {
|
|
add_header Cache-Control "no-cache";
|
|
}
|
|
|
|
# Assets (images, fonts) : cache 7 jours
|
|
location ~* \.(jpg|jpeg|png|gif|webp|svg|woff2|woff|ttf|ico)$ {
|
|
add_header Cache-Control "public, max-age=604800";
|
|
}
|
|
|
|
location / {
|
|
try_files $uri $uri/ $uri.html /index.html;
|
|
}
|
|
}
|