Closed joewandy closed 4 years ago
So I followed Section 9 (Redirecting Based on Host Name) in https://gist.github.com/soheilhy/8b94347ff8336d971ad0, and added the following to to /etc/nginx/sites-enabled/default
:
server {
listen 80;
listen [::]:80;
server_name pals.glasgowcompbio.org;
location / {
proxy_pass http://127.0.0.1:8501/;
}
}
Going to http://pals.glasgowcompbio.org/, the page loads initially, but it throws a lot of timeout (400) errors in the developer console.
Turned out to be a bit tricky. Need to specify external address to streamlit to stop CORS errors.
--browser.serverPort=80 --browser.serverAddress=pals.glasgowcompbio.org
Also needed to change nginx config
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
listen [::]:80;
server_name pals.glasgowcompbio.org;
location / {
proxy_pass http://127.0.0.1:8501;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
Currently PALS Viewer is running on port 8501 (default for Streamlit). It can be accessed on http://134.122.111.79:8501, but we want to access it from http://pals.glasgowcompbio.org/ instead.
We should configure nginx to forward to the right port based on http request. See: