{{UPDATE:
I figured out the problem. I had the NGINX file set on the “external” IP:8501 and not the Network IP:8501, equivalent to localhost:8501. This issue was figured out.
However, note that this setup has proven to work great - so anyone setup to run their app under an SSL subdomain, this has been working fine.}}
I’m running an nginx on an AWS EC2 linux ubuntu instance. I have the location file setup and its been running fine. however, I ran a streamlit install update and now all of a sudden it isn’t. What is curious is that the error I’m getting has to do with a favicon from the looks of it. There is no favicon.ico file in the app directory - I do not know why it keeps doing this, but it gives a 504 Gateway timeout error.
Here is the server file details (cleaned of identifying info):
server {
listen 80;
server_name subdo.name.app;
#redirect HTTP to HTTPs
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name subdo.name.app; # Replace with your actual domain name
# SSL configuration
ssl_certificate /path/to/fullchain.pem; # managed by Certbot
# Path to your SSL certificate
ssl_certificate_key /path/to/privkey.pem; # managed by Certbot
# Path to your private key
location / {
# Basic authentication configuration
auth_basic "Restricted Content"; # This is the message shown in the login prompt
auth_basic_user_file /path/to/.htpasswd; # Path to the file containing the username and password
proxy_pass http://XX.XXX.XX.XXX:8501;
proxy_http_version 1.1;
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_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
Here is what the nginx error log is showing:
2024/05/07 11:12:23 [error] 1991#1991: *7 upstream timed out (110: Unknown error) while connecting to upstream, client: XXX.XXX.X.X.X, server: subdo.name.app, request: "GET / HTTP/1.1", upstream: "http://XX.XXX.XX.XXX:8501/", host: " subdo.name.app"
2024/05/07 11:13:23 [error] 1991#1991: *7 upstream timed out (110: Unknown error) while connecting to upstream, client: XXX.XXX.X.X.X, server: subdo.name.app, request: "GET /favicon.ico HTTP/1.1", upstream: "http://XX.XXX.XX.XXX:8501/favicon.ico", host: " subdo.name.app", referrer: "https:// subdo.name.app/"
again, I want to emphasize that this was working just fine the last few days. This morning the server was down, so I rebooted it - everything is back running, nginx is up and status is good. I am running the app inside of a tmux session and detaching so it stays live - all of that is working - but the above are the relevant factors pertinent to the issue. Here is the content of my requirements.txt file used to install everything this morning:
pandas==2.2.0
streamlit>=1.31.0
openpyxl~=3.1.2
sqlalchemy~=2.0.27
python-dotenv~=1.0.1
pandasql~=0.7.3
numpy~=1.26.3
boto3==1.34.54
botocore==1.34.54
openpyxl==3.1.2
Pillow==10.2.0
tinydb==4.8.0
XlsxWriter==3.2.0
werkzeug
Note that there was a file permissions issue previously - that has been resolved. I can’t think of anything else to include regarding this.
A few other points on this.
- I’ve not previously had to have a .streamlit directory with a config.toml - its been working without such a thing up till now.
- It is running fine when I go to http://XXX.XX.X.XXX:8501 and has no errors reporting in the terminal when I run it.
- AWS Security Group is setup to permit traffic appropriately via HTTP and HTTPS, and the SSL certificate are good to go.
- The only thing I did this morning was run a pip install of the requirements.txt file, none of which made a change as all libraries were already installed. I was just testing the procedure for relaunching the app on a new server, using the existing one.
- The app is being run in a tmux session that I then detach from once its running - again, no issues running it and the 8501 port shows it running fine without any error reporting.
Please provide any guidance/direction on how to resolve this problem - my team uses this app daily for their work and its dead right now.