Skip to content

Instantly share code, notes, and snippets.

@petronioamaral
Created August 19, 2020 20:05
Show Gist options
  • Save petronioamaral/1342be2f5c2d5a5ccbe6e5c16309092d to your computer and use it in GitHub Desktop.
Save petronioamaral/1342be2f5c2d5a5ccbe6e5c16309092d to your computer and use it in GitHub Desktop.
change IP vestacp migrate server
OLDIPV4='' # enter here
NEWIPV4=$(curl -s vestacp.com/what-is-my-ip/)

grep -rl "$OLDIPV4" /etc | xargs sed -i "s#$OLDIPV4#$NEWIPV4#g"
find /home/*/conf/ -type f -exec sed -i "s#$OLDIPV4#$NEWIPV4#g" {} \;
mv /usr/local/vesta/data/ips/$OLDIPV4 /usr/local/vesta/data/ips/$NEWIPV4
mv /etc/apache2/conf.d/$OLDIPV4.conf /etc/apache2/conf.d/$NEWIPV4.conf
mv /etc/nginx/conf.d/$OLDIPV4.conf /etc/nginx/conf.d/$NEWIPV4.conf
grep -rl "$OLDIPV4" /usr/local/vesta/data | xargs sed -i "s#$OLDIPV4#$NEWIPV4#g"

service bind9 restart
service apache2 restart
service nginx restart
service vesta restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment