How to migrate a website to a new server without downtime

A safe migration is boring: build the new server, test it privately, then change DNS and keep the old server until you are sure. Here is the plan we follow.

Migration8 min readUpdated 26 Oct 2026

1. Inventory everything first

List what lives on the old server before you touch anything:

  • Sites, domains and their web server settings
  • Databases and database users
  • Cron jobs and background workers
  • Mailboxes and mail routing
  • DNS records and where DNS is managed
  • TLS certificates and PHP or Node versions

2. Build the new server first

Install the same stack and harden it before it holds any data. Follow the hardening checklist, then match PHP, database and web server versions to the old server unless you plan to upgrade on purpose.

3. Copy files and databases

Copy the files with rsync, which can be repeated and only sends changes:

rsync -aHAX --info=progress2 -e ssh /var/www/site/ user@new-server:/var/www/site/

Dump the database consistently and import it on the new server:

mysqldump --single-transaction --routines --triggers appdb | gzip > appdb.sql.gz
# on the new server
gunzip -c appdb.sql.gz | mysql appdb

4. Test on the new server before DNS changes

Point your own computer at the new server without changing public DNS. Either edit your hosts file, or ask curl to resolve the domain to the new address (a documentation address is used here):

curl -I --resolve example.com:443:203.0.113.10 https://example.com/

Click through the site, submit forms, log in, check uploads and email sending.

5. Lower the DNS TTL a day ahead

The TTL tells resolvers how long to cache your records. Set it to 300 seconds at least a day before the move, so the change spreads in minutes instead of hours.

6. Final sync and switch

At a quiet hour, pause writes (maintenance mode, or stop the app), run a last rsync and database dump and import, then change the DNS records to the new address. Watch the access log on both servers while traffic moves.

rsync -aHAX --delete -e ssh /var/www/site/ user@new-server:/var/www/site/

7. Verify, then keep the old server

Check pages, forms, certificates and email. Keep the old server running for several days. If something is wrong, rollback is one DNS change back to the old address. Raise the TTL again only after you are happy.

Email is the usual surprise. If mail runs on the old server, plan its move separately, or keep MX records where they are until you have tested.

Questions

How long does a migration take?

A single site is often a day of work including testing. A server with many sites or mail takes longer. A quote after an inventory is the honest answer.

Can you migrate without any downtime?

Usually, for read-mostly sites. Sites that write constantly, such as shops, need a short write freeze at the final sync, which we plan for a quiet hour.

Want this done for you? See our Server migration service: Move sites, databases and mail with a tested switch-over and a way back.

Want this done for you?

We set up and check all of this on client servers, with a backup first and a written record.