rebours/nginx.conf
ordinarthur 5698eba6a8 ok prod
2026-03-13 10:23:05 +01:00

64 lines
2.8 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:3001;
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;
}
# ── SEO (dynamique depuis DB) ────────────────────────────────────────────
location = /robots.txt {
proxy_pass http://127.0.0.1:3001;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
location = /sitemap.xml {
proxy_pass http://127.0.0.1:3001;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
# ── Admin proxy → Fastify (AdminJS) ──────────────────────────────────────
location ^~ /admin {
proxy_pass http://127.0.0.1:3001;
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)$ {
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;
}
}