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.
If you want that all domains goes to the same IP, you can set it globaly instead of per 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'
If you want that all domains goes to the same IP, you can set it globaly instead of per account:
Code: Select all
echo "$newip" > /home/forward-all.txt
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: