//------------------------------------------------------------------- //-------------------------------------------------------------------
Migrate Website to Linux VPS Without Downtime

Zero Downtime Website Migration to Linux VPS Step-by-Step

Moving a live site can be stressful, but with the right workflow, you can migrate website to Linux VPS without downtime by preparing the new server, testing the configuration locally, and switching your DNS records.

In this guide, you will learn to move your website files and database to a new Linux VPS safely, so that visitors can access it online.​

Prerequisites To Migrate Website to Linux VPS Without Downtime

Before you start the migration, you must confirm you have everything required on both the source server and your target VPS.

  • SSH access to both the old server and the new VPS.
  • A configured web server, such as Nginx or Apache, and a database server like MySQL or MariaDB installed on the new VPS.

If you need a new Linux server, you can check PerLod Hosting, which offers affordable Linux VPS plans.

Once you are done with the requirements, proceed to the following steps to migrate a Website to a Linux VPS without downtime.

Back up the Current Website Data

Before moving anything, you must archive your web files and export your database to guarantee data integrity. Connect to your old server via SSH and navigate to your website’s root directory.

Compress your web files with the command below:

cd /path/to/old/webroot
tar -czvf ~/website_backup.tar.gz .

To export your MySQL or MariaDB database, you can run the command below:

mysqldump -u db_user -p db_name > ~/database_backup.sql

Transfer Files and Database to the New VPS

Instead of downloading files to your local machine, you can use rsync to transfer them directly between servers for maximum performance and efficiency.

From your old server, run the command below to transfer files and the database:

rsync -avz ~/website_backup.tar.gz ~/database_backup.sql new_user@new_vps_ip:/home/new_user/

Restore Data on the New Server

Once you copied the files with rsync, log in to your new VPS via SSH to extract the files and import the database into your pre-configured empty database.

To extract the files directly into your new document root, you can run the command below:

sudo tar -xzvf ~/website_backup.tar.gz -C /path/to/new/webroot

Then, restore the database with the following command:

mysql -u new_db_user -p new_db_name < ~/database_backup.sql

Finally, fix the file ownership so your web server can read them:

sudo chown -R www-data:www-data /path/to/new/webroot

The www-data is the default web server user and group for Nginx and Apache on Ubuntu and Debian systems. If you are using a RHEL-based distribution like AlmaLinux or Rocky Linux on the new server, you must use one of the following, based on your web server:

apache:apache
#or
nginx:nginx

Validate Your Setup Before Updating DNS

Before pointing your live domain to the new VPS, you must verify that the site works perfectly on the new server. You can privately view the site on your new server by updating your computer’s local hosts file.

For Windows, you must edit:

C:\Windows\System32\drivers\etc\hosts

For macOS and Linux, you must edit:

/etc/hosts

Add this line at the bottom of the file:

NEW_VPS_IP yourdomain.com www.yourdomain.com

Save the file, flush your DNS cache, and open your browser. You are now secretly viewing your site on the new server. Navigate through the pages to verify the database works and images load correctly, and then remove the line you added when you finish testing.

Point Your Domain to the New Server: Update DNS Records

If you run a busy site like a store or forum, run the mysqldump and rsync commands one more time to catch any final changes before going live.

Once everything is verified, update your DNS records to route global traffic to the new server:

  1. Change your domain’s primary A Record to point to the new VPS IP address.
  2. If possible, lower your domain’s TTL (Time To Live) to 300 seconds a day in advance to speed up global propagation.

Since you tested everything before updating DNS records, visitors on the old server and those already hitting the new one will see the same site throughout the switch without downtime.

FAQs

Will my website go down during migration to a new server?

No. Your site stays online because visitors load the old server until their DNS updates to the new one.

Do I need to update my database connection settings on the new server?

Yes. You must update your site’s configuration file, like wp-config.php or .env, with the new database details.

Is rsync safe for transferring sensitive website data?

Yes. rsync transfers data over SSH by default, which encrypts everything in transit.

Conclusion

Moving a live website doesn’t have to cause downtime. Set up the new server first, copy your files and database with rsync and mysqldump, and test everything using your local hosts file before changing DNS. After you update the A record and DNS finishes updating, your site will run on the new Linux VPS without downtime.

We hope you enjoy this guide on Migrate Website to Linux VPS without Downtime.

Subscribe to our X and Facebook channels to get the latest articles and updates on Linux VPS hosting and trends.

Proxy API Routing Without Code Change

Fix Nginx reverse proxy causing 504 Gateway Timeout

Post Your Comment

PerLod delivers high-performance hosting with real-time support and unmatched reliability.

Contact us

Payment methods

payment gateway
Perlod Logo
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.