# Port proxy setting

**URL:** <https://forum.hestiacp.com/t/port-proxy-setting/866>\
**Category:** Uncategorized\
**Created:** [May 15, 2020, 11:00pm UTC](https://forum.hestiacp.com/t/port-proxy-setting/866 "2020-05-15T23:00:59Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![crazytoo](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/c/c0e974/32.png) [@crazytoo](https://forum.hestiacp.com/u/crazytoo)\
**Post date:** [May 15, 2020, 11:00pm UTC](https://forum.hestiacp.com/t/port-proxy-setting/866/1 "2020-05-15T23:00:59Z")

</div>

i am trying to get the [https://vv.xxx.xx](https://vv.xxx.xx) domain to have a custom stpl and tpl that points to the cpanel  
but i cant get it to work

cpanel.stpl  
###########################################  
server {  
listen %ip%:%proxy\_ssl\_port% ssl http2;  
server\_name %domain\_idn% %alias\_idn%;  
ssl\_certificate %ssl\_pem%;  
ssl\_certificate\_key %ssl\_key%;  
ssl\_stapling on;  
ssl\_stapling\_verify on;  
error\_log /var/log/%web\_system%/domains/%domain%.error.log error;

```
include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;

location / {
    proxy_pass https://%ip%:8083;
    location ~* ^.+\.(%proxy_extentions%)$ {
        root %sdocroot%;
        access_log /var/log/%web_system%/domains/%domain%.log combined;
        access_log /var/log/%web_system%/domains/%domain%.bytes bytes;
        expires max;
        try_files $uri @fallback;
    }
}

location /error/ {
    alias %home%/%user%/web/%domain%/document_errors/;
}

location @fallback {
    proxy_pass https://%ip%:%web_ssl_port%;
}

location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}

include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;

```

}

cpanel.tpl  
##############################################  
server {  
listen %ip%:%proxy\_port%;  
server\_name %domain\_idn% %alias\_idn%;

```
include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;

location / {
    proxy_pass http://%ip%:%web_port%;
    location ~* ^.+\.(%proxy_extentions%)$ {
        root %docroot%;
        access_log /var/log/%web_system%/domains/%domain%.log combined;
        access_log /var/log/%web_system%/domains/%domain%.bytes bytes;
        expires max;
        try_files $uri @fallback;
    }
}

location /error/ {
    alias %home%/%user%/web/%domain%/document_errors/;
}

location @fallback {
    proxy_pass http://%ip%:%web_port%;
}

location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}

include %home%/%user%/conf/web/%domain%/nginx.conf_*;

```

}

i have different combinations changing the port number i stpl or tpl

a little help There is no security concerns the dns server is only local

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [May 16, 2020, 4:55am UTC](https://forum.hestiacp.com/t/port-proxy-setting/866/2 "2020-05-16T04:55:34Z")

</div>

Without propper error notices we don’t know what is wrong…

Please provide them.

---

<div class="post-metadata">

**Author:** ![crazytoo](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/c/c0e974/32.png) [@crazytoo](https://forum.hestiacp.com/u/crazytoo)\
**Post date:** [May 16, 2020, 7:31am UTC](https://forum.hestiacp.com/t/port-proxy-setting/866/3 "2020-05-16T07:31:46Z")

</div>

I am asking how to use the proxy to redirect from https 443 to any other port [https://ssss.dd.j/temp/new:4545](https://ssss.dd.j/temp/new:4545)

I copied the default.stpl and default.tpl to cpanel.stpl and cpanel.tpl then i selected the cpanel in the web configuration /proxy template

Is the any howto or manual to help

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [May 16, 2020, 8:05am UTC](https://forum.hestiacp.com/t/port-proxy-setting/866/4 "2020-05-16T08:05:43Z")

</div>

Please read how Nginx works at [https://nginx.org/en/docs/](https://nginx.org/en/docs/)

More info on this can be found

[http://nginx.org/en/docs/http/ngx\_http\_proxy\_module.html](http://nginx.org/en/docs/http/ngx_http_proxy_module.html)

Good luck 👍

---

<div class="post-metadata">

**Author:** ![crazytoo](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/c/c0e974/32.png) [@crazytoo](https://forum.hestiacp.com/u/crazytoo)\
**Post date:** [May 16, 2020, 2:38pm UTC](https://forum.hestiacp.com/t/port-proxy-setting/866/5 "2020-05-16T14:38:22Z")

</div>

Do you use it ? ie the nginx proxy module?

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [May 16, 2020, 2:44pm UTC](https://forum.hestiacp.com/t/port-proxy-setting/866/6 "2020-05-16T14:44:21Z")

</div>

Yes, I use it allot…

How ever I prefer to teach somebody how to fish instead then catching the fish give it to him.

---

<div class="post-metadata">

**Author:** ![crazytoo](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/c/c0e974/32.png) [@crazytoo](https://forum.hestiacp.com/u/crazytoo)\
**Post date:** [May 16, 2020, 2:52pm UTC](https://forum.hestiacp.com/t/port-proxy-setting/866/7 "2020-05-16T14:52:53Z")

</div>

I get that  
But i dont really know why there is two files stpl and tpl

get that the way it should work it that it has listen port and then proxy it to the other port but  
when i tried it the nginx would not restart or start again until i set the proxy setting back to default

also i have never heard of the saying :  
give a man a fish and you feed him for a day; teach a man to fish and he will setup a proxy server for hosting

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [May 16, 2020, 3:03pm UTC](https://forum.hestiacp.com/t/port-proxy-setting/866/8 "2020-05-16T15:03:48Z")

</div>

.tpl are the files related to http traffic (port 80)  
.stpl includes the ssl certificate for all the related https traffic (port 443)

Without proper debugging and I don’t know what it wrong.

Try to use systemctl status nginx to fetch some error messages maybe it tell some thing more…

---

<div class="post-metadata">

**Author:** ![crazytoo](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/c/c0e974/32.png) [@crazytoo](https://forum.hestiacp.com/u/crazytoo)\
**Post date:** [May 16, 2020, 3:18pm UTC](https://forum.hestiacp.com/t/port-proxy-setting/866/9 "2020-05-16T15:18:11Z")

</div>

aaahaa sure

there are no errors

Other than a name conflict

May 16 17:11:52 [srv1.main.com](http://srv1.main.com) systemd[1]: Starting nginx - high performance web server…  
May 16 17:11:54 [srv1.main.com](http://srv1.main.com) nginx[515]: nginx: [warn] conflicting server name “[mail.main.com](http://mail.main.com)” on 10.10.111.25:80, ignored  
May 16 17:11:54 [srv1.main.com](http://srv1.main.com) nginx[515]: nginx: [warn] conflicting server name “[mail.tamper.com](http://mail.tamper.com)” on 10.10.111.25:80, ignored  
May 16 17:11:54 [srv1.main.com](http://srv1.main.com) nginx[515]: nginx: [warn] conflicting server name “[mail.main.com](http://mail.main.com)” on 10.10.111.25:443, ignored  
May 16 17:11:54 [srv1.main.com](http://srv1.main.com) nginx[515]: nginx: [warn] conflicting server name “[mail.tamper.com](http://mail.tamper.com)” on 10.10.111.25:443, ignored

I tried this setting  
server {  
listen %ip%:%proxy\_ssl\_port% ssl http2; ### Listen to the standart port is this case 443  
server\_name %domain\_idn% %alias\_idn%;  
ssl\_certificate %ssl\_pem%;  
ssl\_certificate\_key %ssl\_key%;  
ssl\_stapling on;  
ssl\_stapling\_verify on;  
error\_log /var/log/%web\_system%/domains/%domain%.error.log error;  
include %home%/%user%/conf/web/%domain%/nginx.hsts.conf\*;  
location / {  
proxy\_pass https://%ip%:8083; ### This should redirect it to port 8083 ???  
location ~\* ^.+.(%proxy\_extentions%)$ {  
root %sdocroot%;  
access\_log /var/log/%web\_system%/domains/%domain%.log combined;  
access\_log /var/log/%web\_system%/domains/%domain%.bytes bytes;  
expires max;  
try\_files $uri @fallback;  
}  
}

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [May 16, 2020, 3:58pm UTC](https://forum.hestiacp.com/t/port-proxy-setting/866/10 "2020-05-16T15:58:34Z")

</div>

Step Change template to the faulty one

And then run

```
 nginx -t

```

This will tell if there is error in the templates

---

<div class="post-metadata">

**Author:** ![crazytoo](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/c/c0e974/32.png) [@crazytoo](https://forum.hestiacp.com/u/crazytoo)\
**Post date:** [May 19, 2020, 7:10pm UTC](https://forum.hestiacp.com/t/port-proxy-setting/866/11 "2020-05-19T19:10:56Z")

</div>

Got it sorted  
When you make changes you need to change the template to default and save og then back and save so that the site can generate the new ngin.conf

---

<div class="post-metadata">

**Author:** ![Raphael](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/raphael/32/5217_2.png) [@Raphael](https://forum.hestiacp.com/u/Raphael)\
**Post date:** [May 19, 2020, 7:22pm UTC](https://forum.hestiacp.com/t/port-proxy-setting/866/12 "2020-05-19T19:22:58Z")

</div>

or run a v-rebuild-user in cli, also available in frontend on the user list after clicking the checkbox, then go to the drop down.
