# NGINX and HTTPS

**URL:** <https://discuss.streamlit.io/t/nginx-and-https/30881>\
**Category:** Deployment\
**Tags:** nginx\
**Created:** [September 20, 2022, 1:05am UTC](https://discuss.streamlit.io/t/nginx-and-https/30881 "2022-09-20T01:05:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![emblmt](https://avatars.discourse-cdn.com/v4/letter/e/838e76/32.png) [@emblmt](https://discuss.streamlit.io/u/emblmt)\
**Post date:** [September 20, 2022, 1:05am UTC](https://discuss.streamlit.io/t/nginx-and-https/30881/1 "2022-09-20T01:05:52Z")

</div>

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](https://discuss.streamlit.io/t/deploy-with-nginx-and-https/17513)). I also add a screenshot of the errors shown in Chrome console.

Thank you very much already!

```auto
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

}

```

```auto
[browser]
serverPort = 8501
serverAddress = "domain.org"

```

![streamlit-error](https://global.discourse-cdn.com/streamlit/original/3X/9/6/96cb00deead10eca2e57b90bfee830cf4db6afd8.png)

---

<div class="post-metadata">

**Author:** ![isakhi](https://avatars.discourse-cdn.com/v4/letter/i/ed655f/32.png) [@isakhi](https://discuss.streamlit.io/u/isakhi)\
**Post date:** [August 16, 2023, 7:52am UTC](https://discuss.streamlit.io/t/nginx-and-https/30881/3 "2023-08-16T07:52:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Thiago\_Jung\_Mendacol](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/thiago_jung_mendacol/32/29832_2.png) [@Thiago\_Jung\_Mendacol](https://discuss.streamlit.io/u/Thiago_Jung_Mendacol)\
**Post date:** [August 21, 2023, 11:48pm UTC](https://discuss.streamlit.io/t/nginx-and-https/30881/4 "2023-08-21T23:48:45Z")

</div>

Try this:  
[https://discuss.streamlit.io/t/streamlit-deployment-guide-wiki/5099/29?u=thiago\_jung\_mendacol](https://discuss.streamlit.io/t/streamlit-deployment-guide-wiki/5099/29)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/streamlit/original/3X/c/f/cf4c2ee0d938358f82448c5fe4b9c3c91d7ce19c.svg) [@system](https://discuss.streamlit.io/u/system)\
**Post date:** [August 20, 2024, 11:49pm UTC](https://discuss.streamlit.io/t/nginx-and-https/30881/5 "2024-08-20T23:49:38Z")

</div>

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
