Spaces:
Sleeping
Sleeping
| events { | |
| worker_connections 1024; | |
| } | |
| http { | |
| include /etc/nginx/mime.types; | |
| default_type application/octet-stream; | |
| upstream flask { | |
| server 127.0.0.1:5000; | |
| } | |
| upstream streamlit { | |
| server 127.0.0.1:8501; | |
| } | |
| server { | |
| listen 7860; | |
| server_name localhost; | |
| # Health check endpoint | |
| location /health { | |
| access_log off; | |
| return 200 "healthy\n"; | |
| add_header Content-Type text/plain; | |
| } | |
| # API endpoints go to Flask | |
| location /api/ { | |
| proxy_pass http://flask/; | |
| 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_cache_bypass $http_upgrade; | |
| } | |
| # Streamlit specific paths | |
| location /_stcore/ { | |
| proxy_pass http://streamlit/_stcore/; | |
| 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; | |
| } | |
| # Health check for streamlit | |
| location /_stcore/health { | |
| proxy_pass http://streamlit/_stcore/health; | |
| proxy_set_header Host $host; | |
| } | |
| # Everything else goes to Streamlit | |
| location / { | |
| proxy_pass http://streamlit/; | |
| 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; | |
| } | |
| } | |
| } |