34 lines
1.0 KiB
Nginx Configuration File
34 lines
1.0 KiB
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name localhost;
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# Important pour les Single Page Applications (React Router)
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# Mise en cache agressive pour les assets statiques fingerprintés
|
|
location ~* \.(?:css|js|gif|jpe?g|png|woff2?|eot|ttf|svg|webp|ico|pdf)$ {
|
|
expires 6M;
|
|
access_log off;
|
|
add_header Cache-Control "public, max-age=15552000, immutable";
|
|
}
|
|
|
|
# Jamais de cache sur les fichiers pilotant les mises à jour PWA
|
|
location = /index.html {
|
|
add_header Cache-Control "no-cache, must-revalidate";
|
|
}
|
|
location = /sw.js {
|
|
add_header Cache-Control "no-store, no-cache, must-revalidate, max-age=0";
|
|
}
|
|
location = /manifest.webmanifest {
|
|
add_header Cache-Control "no-cache, must-revalidate";
|
|
types { } default_type application/manifest+json;
|
|
}
|
|
location ~* ^/workbox-.*\.js$ {
|
|
add_header Cache-Control "public, max-age=15552000, immutable";
|
|
}
|
|
}
|