42 lines
1.9 KiB
Nginx Configuration File
42 lines
1.9 KiB
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name rebours.studio;
|
|
|
|
root /var/www/html/rebours/dist;
|
|
index index.html;
|
|
|
|
# ── API proxy → Fastify ──────────────────────────────────────────────────
|
|
location /api/ {
|
|
proxy_pass http://127.0.0.1:3000;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto https;
|
|
}
|
|
|
|
# ── Cache : Astro hashed → immutable ─────────────────────────────────────
|
|
location /_astro/ {
|
|
add_header Cache-Control "public, max-age=31536000, immutable";
|
|
}
|
|
|
|
# ── Cache : CSS/JS sans hash → revalidation ─────────────────────────────
|
|
location ~* \.(css|js)$ {
|
|
add_header Cache-Control "no-cache";
|
|
}
|
|
|
|
# ── Cache : assets → 7 jours ────────────────────────────────────────────
|
|
location ~* \.(jpg|jpeg|png|gif|webp|svg|woff2|woff|ttf|ico|mp3)$ {
|
|
add_header Cache-Control "public, max-age=604800";
|
|
}
|
|
|
|
# ── HTML : jamais caché ──────────────────────────────────────────────────
|
|
location ~* \.html$ {
|
|
add_header Cache-Control "no-store";
|
|
}
|
|
|
|
# ── SPA fallback ─────────────────────────────────────────────────────────
|
|
location / {
|
|
try_files $uri $uri/ $uri.html /index.html;
|
|
}
|
|
}
|