Template for Nginx Proxy_pass with different ports

I am using proxy_pass Nginx, I have created a template in /usr/local/hestia/data/templates/web/nginx
However, there is a task to use different ports

location / {
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_pass http://1.22.33.44:1860/;
}

In this example port 1860, but when adding another domain to the panel, I will need to use a different port in the proxy_pass line, do I need to create a new template with a different port? Is this the only way out of the situation?

Yes

Right now, Hestia doesn’t have any field to specify a different port when assigning a template to a web domain but if you can find the logic to assign the right port to a specific web domain name, you can create a script with the same template’s name (template_name.sh) and execution perms and it will be executed when adding the template to the web domain or when rebuilding the web domain so you could modify the port by the right one for that domain but as I said you need to figure out the logic to do that.