Skip to content
MetaCode Innovations

How to Move From cPanel to a VPS Without Downtime

A step-by-step plan for moving websites, databases, email and cron jobs from cPanel shared hosting to your own VPS, with the DNS trick that keeps the site online during the switch.

By Muhammad Ammar, Founder & Lead EngineerUpdated 7 min read
Server racks connected to cloud infrastructure

Moving off shared cPanel hosting usually happens for one of three reasons: the site has outgrown the resource limits, the host keeps suspending it for CPU usage, or you want control over PHP versions, caching and security. A VPS fixes all three, but a careless move can take the site offline, lose email, or break checkout.

This guide is the order we follow so visitors never see the switch.

What you need before you start

  • cPanel access with SSH. Most hosts enable SSH on request. Without it you can still use the Backup Wizard, but it is slower.
  • A VPS with at least the RAM and disk your sites use today, plus headroom. Ubuntu 24.04 LTS or Debian 12 are good defaults.
  • Access to your DNS. Know where your domain's DNS is actually hosted. It might be your registrar, Cloudflare, or the cPanel host itself.
  • A list of everything the account does. Websites, databases, mailboxes, forwarders, cron jobs, SSL certificates, subdomains and any custom PHP settings.

That last list is where most migrations go wrong. Write it down from the cPanel dashboard before you touch anything.

Step 1: Lower the DNS TTL a day early

TTL (time to live) tells resolvers how long to cache your DNS records. If it is set to 14400 (4 hours) or 86400 (24 hours), some visitors will keep reaching the old server for that long after you switch.

Change the TTL of your A, AAAA and www records to 300 seconds at least 24 hours before the move. Check it took effect:

dig +noall +answer yourdomain.com A

The second column is the TTL. Once it shows 300 or less, a change will reach almost everyone within five minutes.

If the DNS zone is hosted by the cPanel host, move DNS to an independent provider such as Cloudflare first. Otherwise you lose control of DNS the moment you cancel the old hosting.

Step 2: Build and secure the VPS

Set up the server fully before copying any data. On Ubuntu or Debian:

apt update && apt upgrade -y
adduser deploy && usermod -aG sudo deploy
ufw allow OpenSSH && ufw allow 80,443/tcp && ufw enable

Then:

  1. Add your SSH key for the new user, and set PasswordAuthentication no and PermitRootLogin no in /etc/ssh/sshd_config.
  2. Install the web stack: Nginx or Apache, the same PHP major version the site runs today (check it in cPanel under MultiPHP Manager), and MariaDB or MySQL.
  3. Install the PHP extensions the site needs. For WordPress that is usually mysql, curl, gd or imagick, mbstring, xml, zip and intl.
  4. Turn on automatic security updates with unattended-upgrades, and install fail2ban.

Match the PHP version first and upgrade later. Changing hosting and PHP version in the same step makes it hard to tell which one broke something.

Step 3: Copy the files with rsync

From the VPS, pull the files straight from the cPanel account over SSH:

rsync -avz --progress -e "ssh -p 22" \
  cpaneluser@old-server-ip:public_html/ /var/www/yourdomain.com/

Replace 22 with your host's SSH port; some shared hosts use a different one. Addon domains and subdomains usually live in their own folders next to public_html, so copy those too.

rsync only sends changed files, so you can run the same command again at the end and it finishes in seconds.

Fix ownership after the copy:

chown -R www-data:www-data /var/www/yourdomain.com

Step 4: Move the database

Export on the old server. --single-transaction takes a consistent copy without locking a live InnoDB database:

mysqldump --single-transaction --routines --triggers \
  -u cpaneluser_dbuser -p cpaneluser_dbname > site.sql

Create the database and user on the VPS, then import:

CREATE DATABASE site_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'site_user'@'localhost' IDENTIFIED BY 'a-long-random-password';
GRANT ALL PRIVILEGES ON site_db.* TO 'site_user'@'localhost';
mysql -u site_user -p site_db < site.sql

Update the database name, user and password in the site's config, for example wp-config.php. cPanel prefixes database names with the account name, so they will not match unless you recreate them identically.

If the file path changed (for example from /home/cpaneluser/public_html to /var/www/yourdomain.com), search the database and config files for the old path. On WordPress:

wp search-replace '/home/cpaneluser/public_html' '/var/www/yourdomain.com' --all-tables --dry-run

Remove --dry-run once the output looks right. Don't replace the domain name: it stays the same.

Step 5: Recreate the web server config and SSL

Create a virtual host for each domain. cPanel's .htaccess rules still work if you use Apache. With Nginx you need to translate them, especially redirects and WordPress permalinks:

location / {
    try_files $uri $uri/ /index.php?$args;
}

You can't get a Let's Encrypt certificate over HTTP until DNS points at the VPS. Two ways around it:

  • Use a DNS challenge (certbot certonly --manual --preferred-challenges dns, or a DNS plugin for your provider) to issue the certificate before the switch.
  • If the domain is behind Cloudflare's proxy, use a Cloudflare Origin Certificate on the VPS and keep SSL mode on Full (strict).

Either way, HTTPS works the moment traffic arrives.

Step 6: Test the new server before anyone else sees it

Point only your own computer at the VPS by editing your hosts file (/etc/hosts on Mac and Linux, C:\Windows\System32\drivers\etc\hosts on Windows):

203.0.113.10  yourdomain.com
203.0.113.10  www.yourdomain.com

Now your browser loads the VPS while everyone else still uses cPanel. Check:

  • Every page type loads, including posts, categories, search and 404 pages.
  • Log in to the admin area and save something.
  • Submit every contact form and confirm the email arrives.
  • If it is a shop: add to cart, check out with a test payment, and check the order email.
  • Images and uploads load, and there are no mixed-content warnings.
  • The PHP error log is empty: tail -f /var/log/nginx/error.log or the PHP-FPM log.

Remove the hosts-file lines when you're done.

Step 7: Don't forget email and cron jobs

Email is the part most often lost. cPanel mailboxes live on the old server. Choose where they go before the switch:

  • Move to Google Workspace or Microsoft 365. Create the mailboxes, copy old mail over IMAP (both offer migration tools, or use imapsync), then change the MX records.
  • Keep email at the old host for now. Leave the MX records pointing there and only move the website. This is a valid choice if you're keeping the cPanel plan anyway.

Whatever you choose, also check SPF, DKIM and DMARC records. If the website sends mail (contact forms, order emails), send it through an SMTP service such as Amazon SES, Postmark or Resend instead of the VPS directly. Mail from a fresh VPS IP often lands in spam.

Cron jobs are listed under Cron Jobs in cPanel. Recreate each one on the VPS with crontab -e, updating the paths. For WordPress, replace wp-cron.php page-load triggers with a real cron job:

*/5 * * * * cd /var/www/yourdomain.com && wp cron event run --due-now >/dev/null 2>&1

Step 8: Final sync and DNS switch

Pick a quiet time for your audience. Then:

  1. Freeze changes. Put the old site in maintenance mode if it takes orders or comments, so nothing is written to the old database after the final export.
  2. Run the final sync. Re-run the rsync command from step 3, then dump and import the database again.
  3. Switch DNS. Change the A (and AAAA, if used) records to the VPS IP.
  4. Watch both servers. Tail the access logs on the VPS to see traffic arrive, and the old server's logs to see it fade.
tail -f /var/log/nginx/access.log

With a 300-second TTL, most traffic moves within minutes. If something breaks, change the DNS back. The old server still has everything.

Step 9: After the move

  • Keep the cPanel account for at least 7 days. Some resolvers ignore low TTLs, and you may find a missed file or mailbox.
  • Set up backups on the VPS that are stored off the server, and test a restore. Shared hosts often back up for you; a VPS doesn't.
  • Add uptime and disk monitoring, so you hear about a full disk or a crashed service before customers do.
  • Raise the TTL back to 3600 or higher once you're sure you won't need to switch back.
  • Check Search Console for crawl errors over the following week.

When to get help

A single brochure site is a reasonable DIY project if you're comfortable with SSH. Get help if the account holds many sites, active email, a shop that takes payments, or custom server software, or if you don't want to be the person patching the server at 2 a.m. afterwards.

We move cPanel accounts to AWS, DigitalOcean, Hetzner and other VPS providers with the steps above, then keep the server patched, backed up and monitored. See cloud server management and Linux server management, or send us your current setup for a quote.

Frequently Asked Questions

Do I need a control panel on the VPS?
No. A plain Linux server with Nginx or Apache, PHP and MySQL or MariaDB is faster and cheaper, but you manage it from the command line. If you or your team need a graphical panel, you can install cPanel/WHM (paid per account), or a free panel like HestiaCP or CloudPanel. Decide before you migrate, because it changes where files and configs live.
How long does a cPanel to VPS migration take?
A single WordPress site usually takes a few hours of work, spread over two days because of the DNS TTL wait. A cPanel account with many sites, mailboxes and custom cron jobs can take several days to move and test properly.
What happens to my email when I move?
Your cPanel mailboxes don't move by themselves. You can run a mail server on the VPS, but most businesses are better off moving email to Google Workspace or Microsoft 365 and only pointing the MX records there. Either way, copy existing mail over IMAP before you change the MX records.
Will my SEO drop after the move?
Not if the URLs, content and HTTPS stay the same and the site is not down. Google sees the same pages on a new IP address. Check Search Console for crawl errors in the week after the switch.
Is a VPS more secure than shared cPanel hosting?
It can be, because you are no longer sharing a server with hundreds of other accounts. But security becomes your job: firewall, SSH hardening, updates, backups and monitoring. An unmanaged VPS that nobody patches is less secure than good shared hosting.

Muhammad Ammar

Founder & Lead Engineer, MetaCode Innovations

Muhammad Ammar is the founder of MetaCode Innovations. He is a DevOps and Linux engineer with 4+ years of hands-on work running production servers, control panels, AWS and container platforms, and holds the EC-Council Certified SOC Analyst credential.

Let an Engineer Handle It.

Describe what is happening and send the address. We will reply with next steps and a quote.