Page 1 of 1

Reverse Proxy to other Servers Domain

Posted: Sat Mar 09, 2019 10:44 am
by learry
Hi,

I want use Vestacp with Nginx as Reverse Proxy.
I have 2 Server with 2 Domains. I want, if i visit the reverse proxy Domain, display the Script from second Domain.

Things i have done:

Created 2 Files under "/usr/local/vesta/data/templates/web/nginx" :


reverseproxy.stpl

Code: Select all


    server {
    listen      %ip%:%proxy_ssl_port%;
    server_name %domain_idn% %alias_idn%;
    ssl         on;
    ssl_certificate      %ssl_pem%;
    ssl_certificate_key  %ssl_key%;
    error_log  /var/log/%web_system%/domains/%domain%.error.log error;

    location / {
        proxy_pass      https://seconddomainwhatiwantdisplay.com/;
    }

    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/snginx.%domain%.conf*;
}

reverseproxy.tpl

Code: Select all

server {
    listen      %ip%:%proxy_port%;
    server_name %domain_idn% %alias_idn%;
    location / {
        rewrite ^(.*) https://%domain_idn%$1 permanent;
    }
}
I have choose the correct "reverseproxy" Theme for the Domain and have restart the nginx service, but nothing changed.

I work the first time with vestacp and reverse proxy, whats wrong?

Many Thanks

Re: Reverse Proxy to other Servers Domain

Posted: Sun Mar 10, 2019 4:43 am
by mehargags
reexplain what you want to achieve calling them ServerA SiteA and ServerB SiteB