48 lines
1.4 KiB
Nginx Configuration File
48 lines
1.4 KiB
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name localhost;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# Gzip Compression
|
|
gzip on;
|
|
gzip_vary on;
|
|
gzip_min_length 1024;
|
|
gzip_proxied expired no-cache no-store private auth;
|
|
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml application/javascript application/json image/svg+xml;
|
|
|
|
# iOS PWA & Security Headers
|
|
add_header X-Frame-Options "SAMEORIGIN";
|
|
add_header X-Content-Type-Options "nosniff";
|
|
add_header Access-Control-Allow-Origin "*";
|
|
|
|
# HTML pages must NEVER be cached by browser/CDN
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
add_header Cache-Control "no-cache, no-store, must-revalidate, max-age=0";
|
|
add_header Pragma "no-cache";
|
|
add_header Expires "0";
|
|
}
|
|
|
|
# Cache Service Worker with no-cache so updates apply immediately
|
|
location = /sw.js {
|
|
add_header Cache-Control "no-cache, no-store, must-revalidate, max-age=0";
|
|
add_header Pragma "no-cache";
|
|
add_header Expires "0";
|
|
}
|
|
|
|
# Static assets with revalidation
|
|
location ~* \.(css|js|json)$ {
|
|
add_header Cache-Control "no-cache, must-revalidate, max-age=0";
|
|
add_header Pragma "no-cache";
|
|
add_header Expires "0";
|
|
}
|
|
|
|
# Images & icons
|
|
location ~* \.(svg|png|jpg|jpeg|ico|webp)$ {
|
|
expires 1d;
|
|
add_header Cache-Control "public, max-age=86400";
|
|
}
|
|
}
|