Port proxy setting

i am trying to get the 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

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

Please provide them.

I am asking how to use the proxy to redirect from https 443 to any other port 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

Please read how Nginx works at https://nginx.org/en/docs/

More info on this can be found

http://nginx.org/en/docs/http/ngx_http_proxy_module.html

Good luck :+1:

Do you use it ? ie the nginx proxy module?

Yes, I use it allot…

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

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

.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…

aaahaa sure

there are no errors

Other than a name conflict

May 16 17:11:52 srv1.main.com systemd[1]: Starting nginx - high performance web server…
May 16 17:11:54 srv1.main.com nginx[515]: nginx: [warn] conflicting server name “mail.main.com” on 10.10.111.25:80, ignored
May 16 17:11:54 srv1.main.com nginx[515]: nginx: [warn] conflicting server name “mail.tamper.com” on 10.10.111.25:80, ignored
May 16 17:11:54 srv1.main.com nginx[515]: nginx: [warn] conflicting server name “mail.main.com” on 10.10.111.25:443, ignored
May 16 17:11:54 srv1.main.com nginx[515]: nginx: [warn] conflicting server name “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;
}
}

Step Change template to the faulty one

And then run

 nginx -t

This will tell if there is error in the templates

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

1 Like

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.