Reverse proxy to antother IP
Reverse proxy to antother IP
You can install template that will do reverse proxy.
If you want to apply it to some domain:
Last 'yes' is to restart nginx after each domain, so it can be 'no' and then restart manuly.
To apply redirection to all domains on ONE hosting account:
To apply redirection to all domains on the server:
Code: Select all
wget -nv -O /usr/local/vesta/data/templates/web/nginx/forward.sh http://dl.mycity.tech/vesta/vesta-cp-nginx-tpl/fwd-http2/forward.sh
wget -nv -O /usr/local/vesta/data/templates/web/nginx/forward.tpl http://dl.mycity.tech/vesta/vesta-cp-nginx-tpl/fwd-http2/forward.tpl
wget -nv -O /usr/local/vesta/data/templates/web/nginx/forward.stpl http://dl.mycity.tech/vesta/vesta-cp-nginx-tpl/fwd-http2/forward.stpl
chmod a+x /usr/local/vesta/data/templates/web/nginx/forward.sh
Code: Select all
user='your-vesta-user' # enter
domain='your-domain.com' # enter
newip='xxx.xxx.xxx.xxx' # enter
echo "$newip" > /home/$user/conf/web/forward-all.txt
/usr/local/vesta/bin/v-change-web-domain-proxy-tpl "$user" "$domain" 'forward' 'txt' 'yes'
To apply redirection to all domains on ONE hosting account:
Code: Select all
user='your-vesta-user' # enter
newip='xxx.xxx.xxx.xxx' # enter
echo "$newip" > /home/$user/conf/web/forward-all.txt
for domain in $(/usr/local/vesta/bin/v-list-web-domains $user plain |cut -f 1); do
/usr/local/vesta/bin/v-change-web-domain-proxy-tpl "$user" "$domain" 'forward' 'txt' 'no'
echo "=== Redirected: $domain"
done
service nginx reload
To apply redirection to all domains on the server:
Code: Select all
newip='xxx.xxx.xxx.xxx' # enter
echo "$newip" > /home/forward-all.txt
for user in $(grep '@' /etc/passwd |cut -f1 -d:); do
if [ ! -f "/usr/local/vesta/data/users/$user/user.conf" ]; then
continue;
fi
for domain in $(/usr/local/vesta/bin/v-list-web-domains $user plain |cut -f 1); do
/usr/local/vesta/bin/v-change-web-domain-proxy-tpl "$user" "$domain" 'forward' 'txt' 'no'
echo "=== Redirected: $domain"
done
done
service nginx reload
Tags:
Re: Reverse proxy to antother IP
Hello,
I wanted to put a small vps server as a proxy in front of the domain to relieve the main server. Unfortunately the script does not redirect to my HestiaCP set up main server.
The vps was of course running myvestacp with Debian 11.
I first tested " To apply redirection to all domains on ONE hosting account: " and I saw myvestacp home. then I tested " To apply redirection to all domains on the server: " and the server did not go online after a reboot. is the script compatible with Debian 11?
I wanted to put a small vps server as a proxy in front of the domain to relieve the main server. Unfortunately the script does not redirect to my HestiaCP set up main server.
The vps was of course running myvestacp with Debian 11.
I first tested " To apply redirection to all domains on ONE hosting account: " and I saw myvestacp home. then I tested " To apply redirection to all domains on the server: " and the server did not go online after a reboot. is the script compatible with Debian 11?
Re: Reverse proxy to antother IP
Yes, it's compatible with Debian11.Meister wrote: ↑Fri Nov 19, 2021 12:11 pmHello,
I wanted to put a small vps server as a proxy in front of the domain to relieve the main server. Unfortunately the script does not redirect to my HestiaCP set up main server.
The vps was of course running myvestacp with Debian 11.
I first tested " To apply redirection to all domains on ONE hosting account: " and I saw myvestacp home. then I tested " To apply redirection to all domains on the server: " and the server did not go online after a reboot. is the script compatible with Debian 11?
You tested the script with myVesta?
What do you get when you type:
Code: Select all
systemctl status nginx
Re: Reverse proxy to antother IP
everything ok, it works perfectly now. it was a problem from the hoster
.

Re: Reverse proxy to antother IP
Hello,
a question, is it intended that if you disable "Proxy supportNGINX" that it will still forward? Normally it should not forward then.
a question, is it intended that if you disable "Proxy supportNGINX" that it will still forward? Normally it should not forward then.