45 lines
1.5 KiB
Nginx Configuration File
45 lines
1.5 KiB
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# ── Compression ───────────────────────────────────────────
|
|
gzip on;
|
|
gzip_vary on;
|
|
gzip_types
|
|
text/plain text/css text/javascript
|
|
application/javascript application/json
|
|
image/svg+xml;
|
|
|
|
# ── PWA : cache long sur les assets hasheés ───────────────
|
|
location ~* \.(js|css|woff2?|png|svg|ico|webmanifest)$ {
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable";
|
|
try_files $uri =404;
|
|
}
|
|
|
|
# ── API → backend (service Docker interne) ────────────────
|
|
location /api/ {
|
|
proxy_pass http://backend:3001/api/;
|
|
proxy_http_version 1.1;
|
|
|
|
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 $scheme;
|
|
|
|
# Nécessaire pour l'upload d'images (jusqu'à 15 Mo)
|
|
client_max_body_size 20m;
|
|
|
|
# Timeout généreux pour la génération PDF
|
|
proxy_read_timeout 120s;
|
|
}
|
|
|
|
# ── SPA fallback (React Router) ───────────────────────────
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
}
|