File size: 1,520 Bytes
559611f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
server {
listen 7860;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# Enable gzip and pre-compressed file support
gzip on;
gzip_static on;
gzip_comp_level 6;
gzip_vary on;
gzip_proxied any;
gzip_types
text/plain
text/css
text/javascript
application/javascript
application/json
application/xml
application/font-woff
application/font-woff2
application/octet-stream
image/svg+xml;
# Serve .gz files manually if needed
location ~* \.gz$ {
add_header Content-Encoding gzip;
add_header Vary Accept-Encoding;
types {
text/javascript js;
text/css css;
text/html html;
application/octet-stream glb;
}
}
# 🔥 Cache-busting for fingerprinted assets
location ~* \.(js|css|woff2?|eot|ttf|otf|svg|glb|gltf|wasm|png|jpe?g|gif|ico|webp)$ {
add_header Cache-Control "public, max-age=31536000, immutable";
try_files $uri =404;
}
# 🚫 Prevent caching index.html (always load latest)
location = /index.html {
add_header Cache-Control "no-cache";
try_files $uri =404;
}
# 🧩 Optional: glb file support
location ~* \.glb$ {
add_header Content-Type application/octet-stream;
try_files $uri =404;
}
# 🎯 SPA fallback (Vue/React/etc.)
location / {
try_files $uri $uri/ /index.html;
}
}
|