| worker_processes 1; | |
| events { | |
| worker_connections 1024; | |
| } | |
| http { | |
| include mime.types; | |
| default_type application/octet-stream; | |
| # Increase maximum upload size if needed (e.g. for student code or large bodies) | |
| client_max_body_size 50M; | |
| server { | |
| # This port will be replaced dynamically in start.sh | |
| listen 7860; | |
| server_name _; | |
| # Route API to FastAPI | |
| location /api/ { | |
| proxy_pass http://127.0.0.1:8000/api/; | |
| proxy_set_header Host $host; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| } | |
| # WebSocket support for Streamlit | |
| location /_stcore/stream { | |
| proxy_pass http://127.0.0.1:8501/_stcore/stream; | |
| proxy_http_version 1.1; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| proxy_set_header Host $host; | |
| proxy_set_header Upgrade $http_upgrade; | |
| proxy_set_header Connection "upgrade"; | |
| proxy_read_timeout 86400; | |
| } | |
| # Route remaining to Streamlit | |
| location / { | |
| proxy_pass http://127.0.0.1:8501/; | |
| 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 Upgrade $http_upgrade; | |
| proxy_set_header Connection "upgrade"; | |
| } | |
| } | |
| } | |