testing / default.conf
nolascoin's picture
Final Dockerfile + Nginx configs for Hugging Face
559611f
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;
}
}