Migrating WordPress to a VDS: an order that keeps the site up
Moving from shared hosting to a VDS differs from moving between two hosting providers in one key way: a VDS has nothing set up in advance — no web server, no PHP, no database. You need to set those up before copying any files. Below are both working methods and an order of steps that does not leave the site unreachable even for a couple of minutes.
- Set up a LEMP or LAMP stack on the VDS (Nginx/Apache + PHP-FPM + MySQL) with the same or a newer PHP version than the old hosting.
- Copy the site files and take a database dump without stopping the old site.
- Import the database and files on the VDS, and configure a virtual host for the test domain or IP.
- Check the site on the VDS through the
hostsfile, without touching the real domain's DNS. - Switch DNS only after confirming the site works correctly.
Method 1: the All-in-One WP Migration plugin
Fits sites up to 512 MB on the free plugin version — that limit on the exported archive size is set by the plugin itself.
- Install the All-in-One WP Migration plugin on the old site through the WordPress admin.
- Export the site: WP Migration → Export → File, and wait for the
.wpressfile to download. - Install a clean WordPress on the VDS with the same version as the old site.
- Install the same plugin on the new site and import the file through Import.
- The plugin updates the site URL in the database itself — nothing needs to be changed by hand.
Method 2: manual migration with mysqldump and rsync
Fits sites of any size and gives more control over the process.
Files
rsync -avz --progress -e ssh /var/www/old-site/ root@vds-ip:/var/www/new-site/
Database
mysqldump -u user -p --single-transaction wordpress_db > wp_dump.sql
scp wp_dump.sql root@vds-ip:/root/
mysql -u user -p wordpress_db < wp_dump.sql
Replacing the domain in the database
If you are testing the site under a temporary address rather than the live domain, replace links in the database with WP-CLI, not by hand with SQL — WordPress stores serialized arrays, and a plain UPDATE breaks them.
wp search-replace 'https://old-domain.com' 'https://new-domain.com' --all-tables
Configuring wp-config.php on the new server
define('DB_NAME', 'wordpress_db');
define('DB_USER', 'wp_user');
define('DB_PASSWORD', 'new_password');
define('DB_HOST', 'localhost');
Comparing migration methods
| Method | Size limit | Needs SSH | Control over the process |
|---|---|---|---|
| All-in-One WP Migration (free) | up to 512 MB | no | minimal |
| All-in-One WP Migration (Unlimited Extension) | no limit | no | minimal |
| Manual migration (rsync + mysqldump) | no limit | yes | full |
Checking the VDS before the DNS switch
echo "YOUR_VDS_IP example.com www.example.com" | sudo tee -a /etc/hosts
Open the site in a browser — it will connect to the VDS by domain name, while real visitors keep seeing the old hosting. Check admin login, checkout (if this is a WooCommerce store), and that images load correctly from wp-content/uploads.
Common errors after migration
| Symptom | Cause and fix |
|---|---|
| White screen with no error | A PHP extension is missing (usually gd or mysqli) — install the same environment on the VDS as on the old hosting |
| "Error establishing a database connection" | Wrong data in wp-config.php, or MySQL listens on a socket instead of localhost — check DB_HOST |
| Images and styles do not load | Old domain links remain in the database — run wp search-replace again |
| 404 on every page except the homepage | Pretty-URL rules are not configured in Nginx/Apache — add try_files for Nginx or enable mod_rewrite for Apache |
Rollback after a failed migration
- Do not delete the site on the old hosting until the VDS has run for at least a full day.
- If the site behaves unstably after the DNS switch, restore the old A records for the domain.
- Fix the problem on the VDS calmly, and repeat the hosts-based check before switching again.
When this approach does not fit
Without server administration experience, setting up a LEMP stack yourself and the follow-up maintenance (PHP updates, security, backups) can cost more time than the hosting switch saves. In that case it is more sensible to order a free migration handled by ZevsHost onto a managed VDS with a ready-made panel.
Checking the result
- Compare the number of rows in the
wp_poststable on the old and new site. - Check that all plugins are active and do not require a license reactivation.
- Run the site through PageSpeed Insights — a VDS is usually faster than shared hosting.
- Set up automatic backups on the new server before switching DNS — see the article on syncing and backing up servers with rsync.