Skip to content
Wasevo
BlogHosting & Servers 17 min read

Server migration checklist for websites and applications

A step-by-step server migration checklist: inventory, rsync and database dumps, DNS TTL timing, testing before cutover, certificates and rollback.

Sami UllahSami UllahFull-stack Developer
Updated
Server migration checklist for websites and applications

Summarize with:

Share:

A server migration checklist works when it makes you copy the data twice, test the new server before DNS points at it, and keep the old server running until traffic has moved. The order is: inventory what runs on the old server, build and test the new one, and lower DNS TTLs. Then freeze writes, run a final sync and switch DNS. Verify, and retire the old server last.

Key takeaways

  • Files and databases are easy to copy. A cron job, a daemon, a queue worker, a firewall allow-list or a mail record is easy to miss because nothing visits it.
  • Copy twice. A long first sync runs while the site is live, and a short final sync during the cutover carries only what changed.
  • Import a copy of the database and install the certificate on the new server, then test with the real domain before changing DNS, using curl --resolve or a hosts-file entry.
  • Lower DNS TTLs ahead of time, wait out the old TTL, and raise them again only after the move is confirmed.
  • Keep the old server untouched until its traffic reaches zero. That is your rollback.

Server migration checklist or website migration checklist?

"Server migration" and "website migration" describe two different jobs, and the search results mix them up. Google's own documentation separates them. Its guide on changing your hosting covers moves that do not change any visible URL, and its guide on site moves with URL changes covers domain changes, redesigns and HTTP-to-HTTPS moves.

Your situationWhat you needWhere to look
Same domain, same URLs, new host, VPS, cloud or CDNA server migration checklistThis article
New domain, new URL structure, new CMS with different pathsRedirect mapping and a post-launch SEO checkGoogle's site moves with URL changes guide, then Technical SEO before launch and planning a website rebuild for the launch checks
New host and new URLs at the same timeBoth, in two separate phasesMove the server first, change URLs later

Do the two moves separately. If a combined move breaks the site, you cannot tell whether the new server or the new URLs caused it. Move the hosting first, confirm it is stable, then change anything visible.

Step 1. Inventory what the old server does

Files and a database are the obvious parts. The parts that get forgotten are the things that run without a visitor. Walk the old server and write each one down.

ItemHow to find itWhat breaks if you miss it
BackupTake a full backup of the old server before you touch anythingNothing to return to if a step goes wrong
Scheduled jobscrontab -l for each user, /etc/crontab, /etc/cron.d, /etc/cron.daily, /etc/cron.hourly, and systemctl list-timers --allBackups, invoice runs, cache warmers and report emails stop silently
Listening servicessudo ss -tlnp shows listening TCP sockets, their ports and the processes that own them (without root, process names appear only for your own sockets)A queue worker, search engine or Redis instance that the app expects is missing
Docker volumesdocker volume ls, then check each container's mountsThe container starts fine and the data is gone
Environment and secrets.env files, systemd unit files, panel-level PHP settingsThe app boots with wrong keys or default settings
Web server configVirtual hosts, rewrite rules, redirects, upload size and timeout limitsPretty URLs 404, large uploads fail
MailMX, SPF, DKIM and DMARC records, plus any local mail sendingForm notifications land in spam or never arrive
Allow-listsFirewall rules, database host grants, third-party API IP allow-lists, payment gateway callbacksCalls from the new IP are rejected
DNS and registrar accessWho can edit the records, and the current TTL valuesThe migration window arrives and nobody can change DNS

For Docker, the volumes documentation describes volumes as the preferred mechanism for persisting container data, and it has a section on backing up, restoring and migrating them. Copying an image does not move that data.

Also decide what is not moving. Old log archives, unused plugins and abandoned subdomains are cheaper to leave behind than to carry.

Step 2. Build and test the new server before you need it

Install the same runtime versions where you can, and note every difference you cannot avoid, such as PHP, Node or database major versions. A version change is a second migration and deserves its own test pass. Keep cron jobs, queue workers and outbound webhooks disabled on the new server until the cutover. A tested copy with live API keys can send duplicate emails or charge customers twice.

Copy the data once now, while the old site stays live. For files, use rsync over SSH. The commands in this article are for GNU rsync on Linux servers.

bash
# Preview first. -n changes nothing, -i lists what would change.
rsync -aHAXn -i -e ssh --rsync-path="sudo rsync" /var/www/example/ deploy@NEW_SERVER:/var/www/example/

# Real first copy, with overall progress.
rsync -aHAX --info=progress2 -e ssh --rsync-path="sudo rsync" /var/www/example/ deploy@NEW_SERVER:/var/www/example/

The rsync manual explains the flags. -a is archive mode, which is shorthand for -rlptgoD and does not include hard links, ACLs or extended attributes. That is why -H, -A and -X are added. The trailing slash on the source matters. With it, rsync copies the contents of the directory. Without it, rsync creates the directory by name inside the destination. Drop -A and -X if rsync reports that either end does not support them. --info=progress2 needs rsync 3.1.0 or newer, and the manual warns that an older rsync on the server side may reject it. The rsync that ships with macOS rejects both -A and --info=progress2, so install rsync 3 from Homebrew or run the commands from a Linux host. File owners and groups are preserved only when the receiving side runs as root, and --rsync-path="sudo rsync" starts the remote rsync with sudo. Without it, files arrive owned by the login user.

For a database, dump it with the database's own tool. MySQL (MariaDB users should check the flags in the MariaDB documentation):

bash
mysqldump --single-transaction --routines --events --databases appdb > appdb.sql

Per the MySQL manual, --single-transaction takes a consistent snapshot of InnoDB tables without blocking applications, and it only helps with transactional tables. No one should run ALTER TABLE, DROP TABLE, RENAME TABLE or TRUNCATE TABLE while it runs. Triggers are dumped by default, but routines and events need their flags. If the old server uses GTID replication and the new one does not, add --set-gtid-purged=OFF.

Do not put the password on the command line. Use an option file or --login-path, as the MySQL manual advises. Copy appdb.sql to the new server and import it there with mysql < appdb.sql. The --databases flag puts CREATE DATABASE in the dump, so the database is created for you.

PostgreSQL:

bash
pg_dump --format=custom --file=appdb.dump appdb
pg_dumpall --globals-only > globals.sql

The pg_dump documentation says it makes consistent exports while the database is in use and does not block readers or writers. It also says pg_dump is not usually the right tool for regular production backups, so treat it as a migration tool here. It dumps one database only, which is why pg_dumpall --globals-only is used for roles and tablespaces. Restore the globals file first so the roles that own the objects exist, then restore the database on the new server:

bash
sudo -u postgres psql -f globals.sql postgres
sudo -u postgres pg_restore --create --dbname=postgres appdb.dump

Run both as a PostgreSQL superuser. The pg_dumpall documentation says you need superuser privileges to run the saved script, and that restoring it is certain to report a "role already exists" error for the bootstrap superuser, which is harmless and should be ignored.

With --create, the pg_restore documentation says the database named with -d is used only to issue the initial DROP DATABASE and CREATE DATABASE commands, and the data goes into the database named in the archive. A dump made with pg_dump can be expected to load into newer PostgreSQL versions but not necessarily older ones, so keep the new server on the same or a newer major version.

Dump files contain customer data, and globals.sql contains role password hashes. Create them with umask 077, move them over SSH, and delete them from both servers once the import is verified.

Now test. Do not wait for DNS. Send a request to the new server while asking for the real hostname:

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

The curl manual describes --resolve as a custom address for a host and port pair, like a command-line version of an /etc/hosts entry. Replace 203.0.113.10 with the new server's IP address. A hosts-file entry does the same job in a browser. Then click through what matters to the business: login, search, forms, a test checkout and file uploads. Send test emails to yourself, and switch payment gateways to test mode so that testing creates no real charges or customer notifications.

If you use a temporary public hostname instead, add a noindex rule so search engines do not index the copy. Google's hosting guide recommends this. It also says to remove any such block, including a robots.txt disallow, before the move starts.

Step 3. Lower DNS TTLs

A TTL (time to live) tells resolvers how long they may cache a record. If the old TTL is 24 hours, some resolvers will keep sending visitors to the old IP address for up to 24 hours after you change the record. Lowering the TTL only helps after the old, longer TTL has expired, so the order is:

  1. Note the current TTL for the A, AAAA and CNAME records that will change. Check with dig +noall +answer example.com A. The second column of the answer is the TTL in seconds. From a caching resolver it is the time left on the cached copy.
  2. Lower it to a short value such as 300 seconds.
  3. Wait at least as long as the old TTL before you change the record.
  4. After the move is confirmed, raise it again.

Amazon's Route 53 documentation gives the same advice for records in use: set a shorter value first, such as 300 seconds, and increase it after you confirm the new settings are correct. Google's hosting guide gives "a few hours" as its example of a conservative low value and suggests setting it at least a week before the move. Route 53's example is 300 seconds. A caching resolver shows only the time left on its cached copy, so to read the configured TTL, query your DNS provider's name server directly, for example dig +noall +answer example.com A @ns1.example-dns.com. Keep the old server running after the switch, because visitors whose resolvers still hold the old record keep reaching it until their cache expires.

Step 4. Certificates and mail

Have the certificate ready on the new server before you change DNS. A certificate that does not exist there shows visitors a browser warning, even when every file copied correctly. With the HTTP-01 challenge, the new server cannot issue its own certificate until DNS points at it. The Let's Encrypt documentation explains that HTTP-01 fetches a file from your web server at /.well-known/acme-challenge/, while DNS-01 asks you to publish a TXT record under _acme-challenge.<your domain>. DNS-01 does not need DNS to point at the new server, and it allows wildcard certificates, but it needs a DNS provider with an API if you want automatic renewal.

You have two ways to be ready:

  1. Issue the certificate on the new server with the DNS-01 challenge. The Certbot guide lists the DNS plugins and says certificates created with the manual plugin do not renew automatically unless you supply a hook script.
  2. Copy the certificate directory from the old server with rsync -a, which keeps symlinks intact. Certbot saves certificates under /etc/letsencrypt/live/ and updates that directory when it renews, so copy the whole /etc/letsencrypt directory rather than single files.

After the cutover, run certbot renew --dry-run on the new server. It tests renewal of the certificates that exist on that machine without issuing a live one, so it only means something once a certificate is installed there.

For mail, decide whether mail moves at all. Many sites use a separate provider for mailboxes, and only the website moves. In that case, leave the MX records alone. If the old server sends mail directly, such as password resets and order confirmations, the new IP address needs to be authorised in your SPF record. SPF lists permitted sending hosts with mechanisms such as ip4, ip6, a and mx, as defined in RFC 7208. If you sign mail with DKIM, the signing key must also exist on the new server.

Step 5. Cut over

Start only when the new server has the application, a database copy, the certificate and passing tests. Pick a quiet period using your own analytics and write the order of steps down with a name against each one. A cutover has six parts.

  1. Freeze writes on the old server. For a brochure site this means nothing. For a shop, a membership site or anything with user content, put the site in maintenance mode or read-only mode, and pause queue workers and scheduled jobs. This window is the only planned downtime. Its length is the final rsync plus the final database dump and import. On a database-backed site the dump and import usually take longer than the file sync, so time them on the first copy and use that as your estimate. If you cannot freeze writes, you need replication or a reconciliation plan, and that is a bigger project.
  2. Run the final sync. Repeat the rsync copy. It transfers only what changed. Exclude files that must differ on the new server, such as .env or wp-config.php, with --exclude, for example --exclude='.env' --exclude='wp-config.php'. Otherwise the final sync overwrites the new server's database host and credentials. Add --delete only if you want files removed on the old server to disappear on the new one, and run it with -n first. --delete removes files from the destination.
  3. Repeat the dump and import. Use the same commands as in step 2 and import the fresh dump on the new server. If you imported the copy under a temporary hostname, run a search-replace to the real one. WordPress stores URLs in the database, and the WP-CLI search-replace command handles PHP-serialized data, which a plain SQL find-and-replace does not.
  4. Smoke-test the new server before DNS changes. Run the curl --resolve test again, then one real login and one test form. If it fails, nothing public has changed yet.
  5. Switch DNS. Update the A and AAAA records. Remove old AAAA records if the new server has no IPv6, since visitors with IPv6 would otherwise still reach the old host. Then check the answer from a public resolver and from your DNS provider's name server, for example dig +short example.com A @1.1.1.1. Both should return the new IP address. Resolvers that cached the old record keep returning it until the old TTL expires.
  6. Verify, using the checks below, before you lift maintenance mode on the new server and restart its background jobs in a deliberate order. Leave the old server in maintenance mode until you retire it. If maintenance mode is a flag file in the web root, the final rsync copied it to the new server, so remove it there once the checks pass.

Do not update the CMS, upgrade the database or change the theme in the same window. Each extra change makes a failure harder to diagnose.

Step 6. Verify after the move

Do not stop at the home page. Check these on the live domain:

CheckHow
Traffic is arriving on the new serverWatch the access logs on both servers. Old-server traffic falls as caches expire, and new-server traffic rises
HTTPS is valid and the redirect from HTTP workscurl -I http://example.com/ should return a redirect to HTTPS
Forms, search, login and checkout completeRun each as a real user would
Scheduled jobs ranLook for the output of a job that should have run since the cutover
Email arrives and passes authenticationSend a test message to an external mailbox and inspect the headers
Google can reach the siteUse the URL Inspection tool in Search Console, and make sure your firewall or DoS protection does not block Googlebot
Search Console verification still worksIf you verified with an HTML file or a meta tag, copy it to the new server

Google's guide also notes that a temporary drop in crawl rate right after a hosting change is normal, followed by a recovery over the next few days, as long as Googlebot meets no serious errors or slowdowns.

Step 7. Keep the old server, then retire it

The old server is your rollback, so do not touch it. Google's guide says to shut down the old hosting once its logs show traffic has reached zero. Set a date for that check in the plan. After the cutover, any data written on the new server is not on the old one, so rolling back later means copying the new writes back. Decide in advance who may make that call and after what point rollback stops being a quick DNS change and becomes a data reconciliation.

Before shutting down, take a final backup of the old server and keep it somewhere safe for the period you chose. Remove the old server's access keys and database grants. Record the new setup in writing: who pays the provider, who receives alerts, what is backed up and where, and where the runbook lives.

When to bring in help

Applications with databases, queues, scheduled jobs and integrations need a written plan and a staged cutover. A migration like that needs a staged plan. See server migration for what a migration covers, or hosting and server management if you want someone to run the new server afterwards. If the site needs ongoing care after the move, read about website maintenance retainers.

Frequently asked questions

Time the first rsync and the first dump and import. Together they predict the copy time, and the first copy can run while the site is live. The write-freeze window is the final rsync plus the final dump and import. Add the TTL wait from step 3 and the monitoring period on top.

Sami Ullah

Written by

Sami Ullah

Full-stack Developer at Wasevo. Writes about web and app builds, hosting, migrations, WHMCS and keeping servers healthy.

Related articles

Get new guides by email

One short email when we publish something useful. No spam; unsubscribe at any time.

Servers · Migrations · Maintenance

Keep it fast, backed up and updated.

Book a free call

15 minutes, no sales pitch