Spaces:
Sleeping
Sleeping
| # nginx.conf π§ββοΈβ¨ (one port to rule them all: 7860) | |
| worker_processes 1; | |
| events { worker_connections 1024; } | |
| http { | |
| sendfile on; | |
| tcp_nopush on; | |
| tcp_nodelay on; | |
| # logs off = quieter (and less βwhy are we yelling?β) | |
| access_log off; | |
| error_log /dev/stderr warn; | |
| upstream fastapi_upstream { server 127.0.0.1:8000; } | |
| upstream streamlit_upstream { server 127.0.0.1:8501; } | |
| server { | |
| listen 7860; | |
| # β FastAPI JSON endpoints | |
| location /api/ { | |
| proxy_pass http://fastapi_upstream/; | |
| proxy_set_header Host $host; | |
| proxy_set_header X-Forwarded-Proto $scheme; | |
| } | |
| # β Streamlit admin console (websocket-y) | |
| location /admin/ { | |
| proxy_pass http://streamlit_upstream/; | |
| proxy_http_version 1.1; | |
| proxy_set_header Host $host; | |
| # Websocket headers π | |
| proxy_set_header Upgrade $http_upgrade; | |
| proxy_set_header Connection "upgrade"; | |
| proxy_read_timeout 86400; | |
| } | |
| # Root -> admin (because βwhere am I?β should be answered kindly π) | |
| location = / { return 302 /admin/; } | |
| } | |
| } | |