Migrating WordPress from cPanel to Managed VPS (CLI Guide)
A full CLI migration guide using mysqldump and rsync to move WordPress from cPanel to a managed VPS with zero downtime.
Ditching the GUI for CLI Migrations
Moving a large WordPress site from shared cPanel hosting to a managed VPS (like DigitalOcean, Vultr, or a local Malaysian datacenter) using backup plugins often fails due to PHP memory limits and execution timeouts. The professional, bulletproof method is using the Command Line Interface (CLI).
1. Syncing Files with Rsync
SSH into your new VPS. We will pull the files directly from the old cPanel server using rsync. This is vastly superior to FTP as it compresses data, preserves permissions, and resumes if interrupted.
# Run this on the NEW server
rsync -avzP -e "ssh -p 22" cpanel_username@old_server_ip:/home/cpanel_username/public_html/ /var/www/yourdomain.com/public_html/
Ensure ownership is correct on the new server (assuming Nginx/Ubuntu):
chown -R www-data:www-data /var/www/yourdomain.com/public_html/
2. Exporting and Importing the Database
SSH into the old cPanel server and export the database:
mysqldump -u db_user -p db_name > backup.sql
Transfer the backup.sql file to the new server (using scp or rsync), then import it on the new server:
mysql -u new_db_user -p new_db_name < backup.sql
3. Updating wp-config.php
On the new server, edit the wp-config.php file to point to the new database credentials.
define( 'DB_NAME', 'new_db_name' );
define( 'DB_USER', 'new_db_user' );
define( 'DB_PASSWORD', 'new_secure_password' );
define( 'DB_HOST', 'localhost' );
4. Zero-Downtime DNS Switch
Before changing DNS, edit your local machine's /etc/hosts file to point your domain to the new VPS IP. Verify the site loads perfectly.
Once confirmed, update your Cloudflare or Domain Registrar DNS A-record to the new IP. The TTL (Time to Live) should be lowered to 5 minutes beforehand to ensure rapid global propagation.
Migrating critical infrastructure shouldn't be stressful. We execute seamless, zero-downtime migrations for enterprise clients like UrusHQ, ensuring no data loss or SEO drops.
Let JagaWeb handle your migration strategy with our RM5,000 Ownership & Access Review, and maintain your new VPS securely with our RM450/month Care Plan.
Ready to verify who owns your website?
Replace uncertainty with a decision-ready ownership and access report. The fixed Ownership & Access Review is RM1,500 before SST and includes a 30-day action plan.