Symptoms
After the server IP is changed, the IP Migration Wizard is usually able to replace all references to the IP for the cPanel accounts and the Apache Vhosts in /etc/apache2/conf/httpd.conf file
Cause
Note: Make sure to replace $cpuser with the actual cPanel user
However, due to leftover entries of the old IP at /var/cpanel/userdata/$cpuser folder for the specific cPanel user the IP Migration Wizard would not work and a manual change is required.
Resolution
To manually replace the old IP with the new one, please follow the steps below.
Note: Make sure to replace $OLD_IP and $NEW_IP with the appropriate values for your server.
- Login to your server as
rootvia SSH or use WHM Terminal -
Confirm the old IP entries still exist with the following commands
# grep -Ril $OLD_IP /etc
# grep -Ril $OLD_IP /var/cpanel/userdata/
The commands will list all files which include your previous IP address.
-
Execute the following command to replace them in 1 go for the specific cPanel user
# sed -i 's/$OLD_IP/$NEW_IP/g' /var/cpanel/userdata/$cpuser/
This can also be done in bulk for all accounts if necessary when running the command against the userdata folder itself.
# sed -i 's/$OLD_IP/$NEW_IP/g' /var/cpanel/userdata/
-
Next and final step is to rebuild the secondary files that include those entries with the following command.
# /scripts/updateuserdomains ; /scripts/updateuserdatacache ; /scripts/rebuildhttpdconf ; /scripts/restartsrv_httpd
CPANEL_INFO: If you have a lot of cPanel accounts and prefer to refresh the data for all of them, you can directly rebuild the userdata folder then execute step 4 from the above instructions.
Comments
0 comments
Article is closed for comments.