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"
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
systemctl reload bind9
PHPVER=$(/usr/local/vesta/bin/v-get-php-version-of-domain $NEWHOST)
sed -i "/^group =/c\group = www-data" /etc/php/$PHPVER/fpm/pool.d/$NEWHOST.conf
sed -i "/request_terminate_timeout/c\request_terminate_timeout = 900s" /etc/php/$PHPVER/fpm/pool.d/$NEWHOST.conf
sed -i "/max_execution_time/c\php_admin_value[max_execution_time] = 900" /etc/php/$PHPVER/fpm/pool.d/$NEWHOST.conf
systemctl restart php$PHPVER-fpm