Guide ·

How to Move a Website from Shared Hosting to a VPS Without Downtime

Move your website or web app from shared hosting to a VPS without downtime: inventory, email and DNS records, Nginx rewrites, database sync and the cutover.

By Ritesh Singh, full-stack developer

Shared hosting is a fine place to start. Sooner or later, though, many businesses outgrow it: the site slows down at busy times, a background job is killed for using too much CPU, the PHP version is years old, or you need to run a Node.js API next to the website. A VPS fixes those problems, but the move itself makes people nervous, and with good reason. Most failed migrations are caused by something on the old host that nobody wrote down. This guide is the order I follow so the switch is invisible to your visitors.

1. Decide whether a VPS is the right next step

A VPS gives you your own CPU and memory, any language version you need, background workers and full control over the web server. It also gives you responsibility for security updates, backups and monitoring. If your site is a few static pages with little traffic, good shared hosting may still be the simpler choice. If you run an online platform with logins, an API for a mobile app, scheduled jobs or several environments, a VPS is usually cheaper and more reliable than upgrading to ever larger hosting plans.

2. Make a full inventory of the old host

Before touching DNS, list everything the current hosting account does for you. Typical items: the website files, every database and its user, the PHP version and extensions in use, cron jobs set up in the control panel, rewrite rules in .htaccess files, configuration files with database passwords and API keys, file upload folders, SSL certificates, email accounts and forwarders, and every DNS record in the zone, including TXT records used for domain verification and email signing.

Cron jobs and email are the two items most often forgotten. A missing cron job fails silently: reminders stop and reports are never generated. Copy every entry with its schedule and command.

3. Plan email separately

On shared hosting, the website and the mailboxes often live on the same server. Moving the website does not mean moving the mail. If you only change the A record for the website, mail keeps working as before, as long as the MX records still point to the old mail server. If you move the whole domain to a new DNS provider such as Cloudflare, copy every MX, SPF, DKIM and DMARC record exactly, or mail will start bouncing.

Do not run mailboxes on the new VPS unless you really have to. If you plan to leave the old host completely, move mail to a dedicated email provider first, as its own small project.

4. Lower the DNS TTL in advance

The TTL on a DNS record tells resolvers how long they may cache the answer. If it is set to several hours, some visitors will keep reaching the old server for that long after you switch. One or two days before the move, lower the TTL on the records you will change to around five minutes. Visitors then follow the switch within minutes, and you can switch back just as quickly.

5. Build the new server to match

Set up the VPS with the basics first: a non-root user with SSH key login, password login disabled, a firewall that allows only SSH, HTTP and HTTPS, and automatic security updates. Then install the same major PHP version and extensions the site uses today. Move first, upgrade PHP later.

Shared hosts usually run Apache, which reads .htaccess files. Nginx does not, so pretty URLs, redirects and blocked folders must be rewritten as Nginx configuration. Go through each rule and test it, because a missing redirect means lost rankings and broken links in old emails. If the project has a frontend and an API, running them as Docker services with Coolify makes later deployments much easier; I describe that setup in deploying a Next.js app and API with Coolify.

6. Copy the site and test it before anyone sees it

Copy the files with rsync or an archive, export the databases with mysqldump and import them on the new server. Update the configuration files with the new database details. Keep folder permissions tight: the web server should be able to write only to upload and cache folders.

Now test the new server without changing DNS. Add a line to the hosts file on your computer that points the domain at the new server's IP, or use a temporary subdomain. Log in, submit the contact form, upload a file, run each cron command by hand and check the error log, while real visitors are still on the old host.

7. Freeze changes and do a final sync

For a brochure site, the copy from step 6 may be enough. For anything where users create data, such as orders, bookings, cases or form entries, the database keeps changing until the moment you switch. Pick a quiet time and put the old site into a short maintenance mode, or disable only the parts that write data. Take a final database dump, import it on the new server, and run rsync again so only changed files are copied.

8. Switch DNS and keep the old host running

Point the A record (and AAAA, if you use IPv6) at the new server. Issue the SSL certificate on the new server as soon as DNS points to it. If the domain sits behind Cloudflare, use the Full (strict) SSL mode, not Flexible, which causes redirect loops.

Do not cancel the old hosting yet. Keep it for at least a week, with its cron jobs disabled so tasks do not run twice. If something was missed, you can still copy it from there.

9. After the move

Set up what the hosting company used to do for you. Schedule database and file backups to storage outside the VPS, and restore one to make sure it works. Add uptime monitoring and disk space alerts. Recreate the cron jobs from your inventory and check they run. In Google Search Console, check for new crawl errors and make sure no URL has changed; if any had to, add 301 redirects. The checks in my Next.js SEO checklist on canonicals, redirects and real 404 pages apply to any site, not only Next.js. Then raise the DNS TTL back to its normal value.

Migration checklist

Before you call the move finished, confirm that: every file, database, cron job and DNS record from the old host is on the list and accounted for; email records are unchanged or moved on purpose; the TTL was lowered in advance; the new server runs the same PHP version; every .htaccess rule has an Nginx equivalent; the site was tested through the hosts file before DNS changed; the final data sync happened during a short freeze; SSL works with no redirect loop; backups run off the server and one restore was tested; and the old host stays available for a week.

Want the move done for you? I move sites and web apps from shared hosting to a VPS with a plan that avoids downtime, then document the setup so your team can run it. See my deployment and server setup service.

Related services

Hire me for this

Want this done for your product?

Start your project →