CommoditySentiment / nginx.conf
Pedot
Fix nginx: move gzip to conf.d/gzip.conf, remove from site config to avoid duplicate directive
0789327
Raw History Blame Contribute Delete
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;
}
}