Stateful_Multiplayer / nginx.conf
awacke1's picture
Create nginx.conf
9b47a8c verified
raw
history blame
1.09 kB
# 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/; }
}
}