Spaces:
Runtime error
Runtime error
Pedot
Fix nginx: move gzip to conf.d/gzip.conf, remove from site config to avoid duplicate directive
0789327 Download nginx.conf from Tengkolok/CommoditySentiment: direct link, hf CLI and curl.
- Browser
- Download file 2.29 kB
-
https://huggingface.co/spaces/Tengkolok/CommoditySentiment/resolve/main/nginx.conf
- Command line
-
hf download hf://spaces/Tengkolok/CommoditySentiment/nginx.conf
-
curl -L -o nginx.conf https://huggingface.co/spaces/Tengkolok/CommoditySentiment/resolve/main/nginx.conf
2.29 kB
| # nginx.conf — serve landing.html / proxy /dashboard to Streamlit | |
| server { | |
| listen 80; | |
| server_name localhost; | |
| root /app; | |
| index landing.html; | |
| # Browser caching for static assets | |
| location ~* \.(html|css|js|json|svg)$ { | |
| expires 5m; | |
| add_header Cache-Control "public, must-revalidate"; | |
| add_header X-Frame-Options "SAMEORIGIN"; | |
| add_header X-Content-Type-Options "nosniff"; | |
| } | |
| # Landing page (SEO + LLM readable snapshot) | |
| location = / { | |
| try_files /landing.html =404; | |
| expires 5m; | |
| add_header Cache-Control "public, must-revalidate"; | |
| add_header X-Frame-Options "SAMEORIGIN"; | |
| add_header X-Content-Type-Options "nosniff"; | |
| } | |
| # Health check | |
| location /health { | |
| access_log off; | |
| return 200 "ok"; | |
| add_header Content-Type text/plain; | |
| } | |
| # Streamlit WebSocket | |
| location /dashboard/_stcore/stream { | |
| proxy_pass http://127.0.0.1:7860/dashboard/_stcore/stream; | |
| proxy_http_version 1.1; | |
| proxy_set_header Upgrade $http_upgrade; | |
| proxy_set_header Connection "upgrade"; | |
| proxy_set_header Host $host; | |
| proxy_read_timeout 86400; | |
| } | |
| location /dashboard/_stcore/health { | |
| proxy_pass http://127.0.0.1:7860/dashboard/_stcore/health; | |
| } | |
| location /dashboard/_stcore/allowed-message-origins { | |
| proxy_pass http://127.0.0.1:7860/dashboard/_stcore/allowed-message-origins; | |
| } | |
| # Streamlit dashboard (fallback) | |
| location /dashboard { | |
| proxy_pass http://127.0.0.1:7860/dashboard; | |
| proxy_http_version 1.1; | |
| proxy_set_header Upgrade $http_upgrade; | |
| proxy_set_header Connection "upgrade"; | |
| 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; | |
| proxy_read_timeout 86400; | |
| } | |
| # Catch-all for dashboard subpaths | |
| location /dashboard/ { | |
| proxy_pass http://127.0.0.1:7860/dashboard/; | |
| proxy_http_version 1.1; | |
| proxy_set_header Upgrade $http_upgrade; | |
| proxy_set_header Connection "upgrade"; | |
| proxy_set_header Host $host; | |
| proxy_read_timeout 86400; | |
| } | |
| } | |