Deploy streamlit app using nginx

I want to deploy the streamlit application on vm .I am able to deploy it to the server ip using tmux .but i am not able to deploy it on custom domain name using nginx.
so can anyone tell me how can i deploy it using nginx with custom domain name.
i have created .service file but i am not able to run it streamlit run in it.

this is what worked for me:

server {

    listen 80;
    server_name helloworld-st-app;

    location / {
        proxy_pass http://app:8501/;
    location ^~ /static {
        proxy_pass http://app:8501/static/;
    location ^~ /healthz {
        proxy_pass http://app:8501/healthz;
    location ^~ /vendor {
        proxy_pass http://app:8501/vendor;
    location /stream {
        proxy_pass http://app:8501/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;


(source: Using Streamlit + Nginx + Docker to build and put in production dashboards in AWS Lightsail | by Daniel Sierra | Medium)