Within the WEB section, you should add your new hostname as a new domain entry, activate Let's Encrypt for it and delete the old hostname.
Next, in your SSH terminal as the root user, execute the following commands to update your server's hostname and DNS settings. Replace the placeholder values with your specific information:
Code: Select all
OLDHOST='' # enter here old hostname
OLDNS1='' # enter here old NS1
OLDNS2='' # enter here old NS2
NEWHOST='' # enter here new hostname
NEWNS1='' # enter here new NS1
NEWNS2='' # enter here new NS2
/usr/local/vesta/bin/v-change-sys-hostname "$NEWHOST"
find /home/*/conf/dns/ -type f -exec sed -i "s#$OLDHOST#$NEWHOST#g" {} \;
find /home/*/conf/dns/ -type f -exec sed -i "s#$OLDNS1#$NEWNS1#g" {} \;
find /home/*/conf/dns/ -type f -exec sed -i "s#$OLDNS2#$NEWNS2#g" {} \;
find /usr/local/vesta/data/users/*/dns/ -type f -exec sed -i "s#$OLDHOST#$NEWHOST#g" {} \;
find /usr/local/vesta/data/users/*/dns/ -type f -exec sed -i "s#$OLDNS1#$NEWNS1#g" {} \;
find /usr/local/vesta/data/users/*/dns/ -type f -exec sed -i "s#$OLDNS2#$NEWNS2#g" {} \;
sed -i "s#$OLDHOST#$NEWHOST#g" /usr/local/vesta/data/users/*/dns.conf
sed -i "s#$OLDNS1#$NEWNS1#g" /usr/local/vesta/data/users/*/dns.conf
sed -i "s#$OLDHOST#$NEWHOST#g" /usr/local/vesta/data/users/*/user.conf
sed -i "s#$OLDNS1#$NEWNS1#g" /usr/local/vesta/data/users/*/user.conf
sed -i "s#$OLDNS2#$NEWNS2#g" /usr/local/vesta/data/users/*/user.conf
sed -i "s/$OLDHOST/$NEWHOST/g" /etc/roundcube/plugins/password/config.inc.php
grep -rl "$OLDHOST" /etc | xargs sed -i "s/$OLDHOST/$NEWHOST/g"
grep -rl "$OLDHOST" /usr/local/vesta/conf | xargs sed -i "s/$OLDHOST/$NEWHOST/g"
sed -i "s#$OLDNS1#$NEWNS1#g" /usr/local/vesta/data/packages/*.pkg
sed -i "s#$OLDNS2#$NEWNS2#g" /usr/local/vesta/data/packages/*.pkg
service bind9 reload
Then we need to tweak few additional things:
Code: Select all
phpv=$(v-get-php-version-of-domain "$NEWHOST")
mcedit /etc/php/$phpv/fpm/pool.d/$NEWHOST.conf
Find:
Code: Select all
group = admin
and change that line to:
Code: Select all
group = www-data
Code: Select all
systemctl restart php$phpv-fpm