NGINX and HTTPS

Hello.
I’m new to Streamlit and Nginx in general, and I am trying to deploy streamlit on my server and use nginx to reach the app through my domain url.

I reached the point now where when trying to access my domain while Streamlit is off, the error 502 bad gateway is displayed. When running streamlit hello, I get nothing but a blank page. Although the page’s title is shown as “Streamlit” . So I guess I am not too far from reaching my goal, could anyone give me some light on what to edit? The app is perfectly reachable (through http) when I type in the server’s IP and the relevant port, though. Running python3 -m http.server 8501 and opening my domain’s url displays a file explorer.

Here are my nginx site configuration and streamlit files (edited mostly according to this post). I also add a screenshot of the errors shown in Chrome console.

Thank you very much already!

server {

        root /var/www/domain/html;
        index index.html index.htm index.nginx-debian.html;

        server_name domain.org www.domain.org;

        location / {
                try_files $uri $uri/ =404;
		proxy_pass http://IP:PORT;
		proxy_set_header Host $http_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_redirect off;
		proxy_http_version 1.1;
		proxy_isset_header Upgrade $http_upgrade;
		proxy_set_header Connection "upgrade";
		proxy_read_timeout 86400;
        }

    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/domain.org/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/domain.org/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


}
server {
    if ($host = www.domain.org) {

        return 301 https://$host$request_uri;
    } # managed by Certbot


    if ($host = domain.org) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


        listen 80;
        listen [::]:80;

        server_name domain.org www.domain.org;
    return 404; # managed by Certbot




}
[browser]
serverPort = 8501
serverAddress = "domain.org"

streamlit-error

Have you been able to resolve this as I am experiencing similar issue?

Try this:
https://discuss.streamlit.io/t/streamlit-deployment-guide-wiki/5099/29?u=thiago_jung_mendacol