Best webserver to use with Streamlit

Hello everyone!

I just started to use Streamlit and I want to use streamlit with a webserver(such as nginx, apache or whatever you suggest).

For now, I just tried to use with NGINX but it is not working on nginx. If you help me to solve NGINX issue, it would be great. Or I am open to all other webserver suggestions.

https://docs.streamlit.io/knowledge-base/deploy/deploy-streamlit-domain-port-80

1 Like

Hello, Franky1

I already see that thread and tried.

Here is my config.toml file:

[server]
# port=80 # change port number. By default streamlit uses 8501 port
headless=true # This will eliminate automatically open browser
enableCORS=false
enableXsrfProtection=false
enableWebsocketCompression=false

And, here is my nginx.conf

    server {
       listen 80;
       server_name 0.0.0.0;
       index index.php index.html index.htm;
       location /demo {
          proxy_pass         http://0.0.0.0:8501/demo;
          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;
    }
       error_page 404 /404.html;
       error_page 500 502 503 504 /50x.html;
       location = /50x.html {
          root /usr/share/nginx/html;
       }
}

When I visit https:ip-adress/demo, this page opens.

I couldn’t solve this issue, do you have any idea?

Here is nginx latest logs

2023/05/30 13:58:21 [error] 18787#18787: *1 open() "/usr/share/nginx/html/common/css/styles.css" failed (2: No such file or directory), client: 127.0.0.2, server: 127.0.0.1, request: "GET /common/css/styles.css HTTP/1.1", host: "127.0.0.1", referrer: "http://127.0.0.1/en-US/index.html"

I’m not sure, but from the error in this log I understand that NGINX is trying to access the streamlit files from /usr/share/nginx/html/ directory and that’s why I’m getting the error. but I have no idea how to fix it. Can you help me?

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