Skip to content

Instantly share code, notes, and snippets.

@anggxyz
Last active November 17, 2021 11:27
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anggxyz/57c70470f9956205a99b761c366d1bb4 to your computer and use it in GitHub Desktop.
Save anggxyz/57c70470f9956205a99b761c366d1bb4 to your computer and use it in GitHub Desktop.
nginx config for deploying streamlit apps from custom url + reverse proxy for port | part of dev-notes: https://gist.github.com/nglglhtr/561e987c1168c868e484f35f76f4c0fd

Start streamlit app with (inside tmux):

streamlit run news-app.py --server.baseUrlPath="/reliability" --server.enableXsrfProtection=false server.enableCORS=false
location /:CUSTOM-PATH/ {
proxy_pass http://127.0.0.1:<PORT>/:CUSTOM-PATH/;
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_buffering off;
proxy_http_version 1.1;
# Also requires websocket:
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
}
nginx.conf can be found inside: `/etc/nginx/nginx.conf`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment