Enterprise MV2 KVM — unlimited bandwidth, high CPU performance. View plans →

How to Migrate Your Website to a VPS Safely

8 min read By Ahmed Moustafa

Ahmed Moustafa

8 min read

Topics vps migration website hosting

Key takeaways

  • Migrate a website to a VPS without downtime by testing the full site on the new server before you touch DNS.
  • Audit every dependency first: PHP version, database engine, cron jobs, SSL, and email routing all need a home on the new box.
  • Lower your DNS TTL 24 to 48 hours before the switch so visitors move to the new server quickly.
  • Keep the old host live and paid for at least a week after cutover so you have a working rollback.
  • Verify data integrity after transfer by comparing row counts and file checksums, not just by eyeballing the homepage.

Learn how to migrate your website to a VPS safely: audit, set up, transfer files and databases, test, then switch DNS with zero downtime.

To migrate your website to a VPS safely, you build and fully test the site on the new server first, then switch DNS only after it works exactly like the old one. Done in that order, visitors never see a broken page, and you keep a clean rollback if something goes wrong.

This guide walks through the whole move: auditing your current setup, building the VPS environment, transferring files and databases and email, testing before the DNS switch, and the post-migration checks that catch the problems screenshots miss. It is written for developers and site owners leaving shared hosting, so it assumes you can open a terminal and run a few commands, but every step is explained inline.

Outages are expensive when they happen. New Relic reports that "many high-impact outages now cost $2 million per hour" (2025 Observability Forecast). Most small sites will never see numbers like that, but the point holds at any scale: a migration that drops your site during business hours costs real money and trust. The method below is built to avoid that.

Server racks with blue indicator lights in a data center corridor

Step 1: Audit your current site and dependencies

You cannot rebuild what you have not inventoried. Before touching the new server, write down everything the current site depends on. Missing one item is how migrations break at 2 a.m.

Walk through this list and record the exact versions:

  • Web server and language runtime. Apache or Nginx? PHP 8.1 or 8.3? Node, Python, Ruby? Match versions on the VPS, because a jump from PHP 7.4 to 8.2 can silently break a plugin.
  • Database. MySQL or MariaDB, and which version. Note the database name, user, and character set.
  • Application details. CMS and version (WordPress, Drupal, a custom app), installed plugins or modules, and any hardcoded paths or absolute URLs in config.
  • Cron jobs. Run crontab -l on the old host. Scheduled tasks like backups, cache clears, and newsletter sends are easy to forget.
  • SSL certificates. Are you using Let's Encrypt or a paid cert? You will reissue on the VPS, so note the domains covered.
  • Email. This is the one people miss. Is mail handled by your host, by Google Workspace, or by a separate provider? Your MX records decide where mail goes, and they are independent of where the website lives.
  • File uploads and media. The wp-content/uploads folder or equivalent can be gigabytes. Size it now so the transfer does not surprise you.

While you are here, take a full backup of both files and the database. You want a restore point that predates any change. If you are still deciding whether a VPS is the right move at all, weigh the control and cost trade-offs against staying on shared hosting before you commit.

Step 2: Set up the new VPS environment

With the audit in hand, provision a VPS that matches or exceeds your current specs. A ByteHosty KVM VPS gives you full root access, NVMe storage, and the Virtualizor panel to reinstall the OS or reboot on demand, which is useful while you experiment. Full virtualization matters here: on KVM you control the kernel and can install anything, unlike container based platforms where the kernel is shared.

Build the stack to match your audit:

  1. Pick and install the OS. Ubuntu LTS and Debian are common, stable choices for web workloads.
  2. Install the web server, runtime, and database. Match the versions you recorded. For a LAMP stack that is Apache, MySQL or MariaDB, and the exact PHP version.
  3. Create the database and user with the same name, user, and permissions your app expects.
  4. Set up the same directory structure your app assumes, so paths in config keep working.
  5. Harden the server before it faces the internet. Configure a firewall, disable password based root login in favor of SSH keys, and keep packages updated.

Do not skip the hardening. A fresh VPS with an open SSH port gets probed within minutes of going live. Configure the firewall, switch to SSH keys, and update every package before you put real data on the box.

Close-up of computer server hardware in a data center

Step 3: Transfer files, databases, and email

Now move the data. Do this over the network with tools built for it, not by downloading everything to your laptop and re-uploading.

Files. Use rsync over SSH. It is resumable and only copies what changed, which matters for large media folders:

rsync -avz -e ssh /var/www/html/ user@your-vps-ip:/var/www/html/

Run it once, then run it again right before cutover to catch files that changed in between.

Database. Dump on the old host, copy the file, import on the VPS:

# On the old server
mysqldump -u dbuser -p mydatabase > mydatabase.sql

# Copy to the VPS
scp mydatabase.sql user@your-vps-ip:~/

# On the VPS
mysql -u dbuser -p mydatabase < mydatabase.sql

After importing, update any hardcoded URLs or paths in the database that still point at the old server. For WordPress, a search-and-replace of the site URL is often needed if the domain or path changed.

Email. Handle mail separately and deliberately. If your website host also runs your mailboxes, decide now where mail will live after the move: on the VPS, or with a dedicated mail provider. Your MX records control delivery, so plan to update them as their own step rather than assuming they follow the website. If mailboxes stay with an external provider like Google Workspace, you leave MX records untouched and only change the A record for the site.

Verify integrity, do not assume it. Compare database row counts between old and new for your key tables, and spot-check file counts or checksums for large directories. A transfer can finish "successfully" and still be missing rows or truncated files. Confirming the numbers match is faster than discovering a gap after go-live.

Step 4: Test before switching DNS to avoid downtime

This is the step that prevents downtime, so do not rush it. The idea is simple: view the full site running on the VPS while the public still hits the old server, so you catch every problem before real visitors do.

Point your own machine at the new server without changing public DNS by editing your local hosts file:

# /etc/hosts  (or C:\Windows\System32\drivers\etc\hosts on Windows)
203.0.113.10   example.com www.example.com

Use your VPS IP. Now your browser resolves the domain to the VPS while everyone else still sees the old host. Test thoroughly:

  • Load the homepage and several inner pages, including dynamic ones.
  • Submit a form and confirm it writes to the database and sends any email.
  • Log into the admin area and the checkout or account flow if you have one.
  • Check that images, CSS, and JavaScript all load, watching for mixed-content or 404 errors in the browser console.
  • Confirm HTTPS works with a valid certificate on the VPS.

Fix everything you find here. When the site behaves identically to production, you are ready to plan the actual switch.

Prepare DNS for a fast switch. Twenty-four to forty-eight hours before cutover, lower the TTL on your A record to something short like 300 seconds. TTL is the time resolvers are allowed to cache a record. Per the DNS standard, TTL "specifies a maximum time to live, not a mandatory time to live" (RFC 2181, Section 8), so a low value tells resolvers to re-check sooner and lets visitors migrate to the new IP quickly once you flip it. Lowering TTL early is what shrinks the "some users on old, some on new" window to minutes instead of a day.

Step 5: Post-migration checks and rollback planning

Once testing passes and TTL is low, do the final rsync and database sync to catch last-minute changes, then update the A record to the VPS IP. Now watch closely.

Run through these checks right after the switch:

  1. Confirm the site resolves to the new IP. Use an online DNS checker or dig example.com +short from a few networks.
  2. Watch server logs live. Tail the web server and error logs on the VPS for 500s, missing files, or database connection errors under real traffic.
  3. Re-test forms and email delivery now that live users are hitting the box.
  4. Verify SSL shows valid across browsers, with no certificate warnings.
  5. Check search visibility basics. Make sure robots.txt did not carry over a Disallow: / from a staging config, and that your sitemap is reachable.

Keep a rollback ready. Do not cancel the old hosting the moment the new site loads. Keep it active and paid for at least a week. If a serious problem surfaces, you switch the A record back to the old IP and you are running again while you diagnose. Because you lowered the TTL, that rollback also takes effect in minutes. Leaving the old server in place is cheap insurance against the failure you did not predict.

Keep an eye on performance for the first few days too. A VPS should feel faster than shared hosting, especially on NVMe storage, so if pages feel slower than before, treat that as a signal to check your web server config, caching, and database tuning rather than the hardware.

Your next step

Pick a low-traffic window, then work this checklist top to bottom on a single site: audit, build, transfer, test on your hosts file, lower TTL, and only then flip DNS. The whole method rests on one habit, which is proving the site works on the new server before the public ever touches it. When you are ready to provision the box, a KVM VPS from ByteHosty gives you the root access, NVMe storage, and DDoS protection to run the migrated site well, and the setup guides above walk you through the rest.

Questions covered

Will migrating my website to a VPS cause downtime?

It should not if you build and test the site on the VPS first, then switch DNS only after it works. Lowering your DNS TTL beforehand shrinks the window when some visitors still hit the old server.

How long does DNS propagation take after I switch to a VPS?

It depends on your record's TTL. If you drop the TTL to 300 seconds a day or two before cutover, most resolvers pick up the new IP within minutes, though some may cache the old value until the previous TTL expires.

Should I keep my old hosting after migrating to a VPS?

Yes. Keep the old account active for at least a week after cutover. It is your rollback path if something breaks, and it holds recent email and data until you confirm the VPS is stable.

Do I need a managed VPS to migrate my website?

No. Unmanaged VPS hosting is fine if you are comfortable on the command line. You handle the OS, web server, and security yourself, which most developers moving off shared hosting can do with a checklist.