How to use Streamlit with Nginx?

It worked out that way for me in the end:

       location / {
           proxy_pass http://localhost:8501/dashboard;
       }
       location /dashboard {
           proxy_pass http://localhost:8501/dashboard;
       }
       location ^~ /static {
           proxy_pass http://127.0.0.1:8501/dashboard/static;
       }
       location ^~ /healthz {
           proxy_pass http://127.0.0.1:8501/dashboard/healthz;
       }
       location ^~ /vendor {
           proxy_pass http://127.0.0.1:8501/dashboard/vendor;
       }
       # Update to reflect the endpoint name change
       location /dashboard/_stcore/stream {
           proxy_pass http://localhost:8501/dashboard/_stcore/stream;
           proxy_http_version 1.1;
           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
           proxy_set_header Host $host;
           proxy_set_header Upgrade $http_upgrade;
           proxy_set_header Connection "upgrade";
           proxy_read_timeout 86400;
       }