Choosing a VPS

How to Move from Shared Hosting to a VPS with No Downtime

By NileVPS Team · Published · 5 min read

اقرأ المقال بالعربي

Shared hosting is a good place to start, but sooner or later many sites outgrow it: pages slow down under traffic, resource limits trigger errors, or you need software the host does not allow. A VPS gives you dedicated resources and full control. The move itself worries people more than it should. With the right order of steps, visitors will not notice anything, because the old site keeps serving traffic until the new one is fully ready.

The principle behind zero downtime

The idea is simple: build and test a complete copy of the site on the VPS while the shared host keeps running, then point DNS to the new server. During DNS propagation some visitors reach the old server and some reach the new one, and both work. The only tricky part is data that changes during the switch, such as orders, comments or user sign-ups, which we handle below.

Step 1: Inventory what you have

Before touching anything, list everything the site depends on:

  • website files, including uploads
  • databases (names, users, versions of MySQL or MariaDB)
  • the PHP version and extensions in use
  • cron jobs configured in the control panel
  • email accounts hosted with the provider
  • DNS records: A, AAAA, CNAME, MX, TXT (SPF, DKIM, verification)
  • SSL certificates and any redirects in .htaccess

Email deserves special attention. If your shared host also handles your mail, decide whether mail stays there, moves to a dedicated mail service, or moves to the VPS. Running your own mail server is a significant job; many people move mail to a specialized provider instead.

Step 2: Lower the DNS TTL early

TTL tells resolvers how long to cache a record. At least 24 to 48 hours before the switch, lower the TTL of your A records to something like 300 seconds. When you later change the IP, the new address spreads quickly instead of lingering for hours.

Step 3: Prepare the VPS

Create a server with a plan that fits your traffic (see pricing), pick a region close to your users, and set up the basics:

sudo apt update && sudo apt upgrade -y
sudo adduser deploy && sudo usermod -aG sudo deploy
sudo ufw allow OpenSSH && sudo ufw allow 'Nginx Full' && sudo ufw enable
sudo apt install nginx mariadb-server php-fpm php-mysql php-curl php-xml php-mbstring php-zip php-gd

Match the PHP version as closely as possible to what the shared host used, then upgrade later as a separate, tested step. Take a snapshot once the base system is ready so you can roll back if something goes wrong.

Step 4: Copy the files

If your shared host offers SSH, rsync is the most reliable tool because it can be run again later to copy only what changed:

rsync -avz --progress user@old-host:~/public_html/ /var/www/example.com/

Without SSH, download a full backup from the control panel, upload it to the VPS with scp, and extract it. Then fix ownership so the web server can read the files:

sudo chown -R www-data:www-data /var/www/example.com

Step 5: Move the database

Export on the old host (through SSH or phpMyAdmin) and import on the VPS:

mysqldump -u olduser -p --single-transaction olddb > site.sql
mysql -u root -p -e "CREATE DATABASE site CHARACTER SET utf8mb4; CREATE USER 'site'@'localhost' IDENTIFIED BY 'strong-password'; GRANT ALL ON site.* TO 'site'@'localhost';"
mysql -u root -p site < site.sql

Update the application's configuration file (for WordPress, wp-config.php) with the new database name, user and password.

Step 6: Configure the web server and test privately

Create an Nginx server block for your domain pointing to the site directory and PHP-FPM socket. Then test before any public change by editing your own computer's hosts file so only you see the new server:

203.0.113.10  example.com www.example.com

On Linux and macOS this file is /etc/hosts; on Windows it is C:\Windows\System32\drivers\etc\hosts. Browse every important page, log in, submit forms, check images and run a test checkout if you run a store. Fix any errors in the Nginx and PHP logs under /var/log/.

Step 7: Handle changing data

For a mostly static site, just switch. For a store or community site, keep the gap small:

  1. Put the old site in maintenance mode or pause orders briefly.
  2. Run rsync again for new uploads and take a final database dump.
  3. Import that final dump on the VPS.
  4. Change the DNS A record to the VPS IP immediately.

With a low TTL, the window lasts minutes, not hours.

Step 8: Switch DNS and issue SSL

Update the A (and AAAA, if used) records. Once the domain resolves to the VPS, issue a free certificate:

sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d example.com -d www.example.com

Step 9: Keep the old host for a while

Do not cancel shared hosting on the same day. Keep it for at least a week while you watch logs, confirm backups run on the VPS, recreate cron jobs and check that email works. Then raise the TTL back to a normal value. For keeping an eye on availability after the move, see our guide to uptime in hosting.

FAQ

Do I need a control panel on the VPS?

No. Many sites run fine with Nginx, PHP-FPM and MariaDB configured by hand. A control panel can make the transition easier if you are used to one, but it uses resources and adds software to maintain.

Will migration affect my search rankings?

Not if URLs stay the same, the site remains reachable throughout and HTTPS keeps working. Search engines care about content and availability, not which server delivers them. Avoid changing URL structure during the same move.

How long does DNS propagation take?

With a TTL lowered to about 300 seconds in advance, most visitors reach the new server within minutes. Some resolvers ignore TTLs and cache longer, which is exactly why the old server should keep running for several days.

Related guides