proxy – Migrate web server to new datacenter and new IP

I use the following migration process in these cases:

  1. Change DNS TTL to minimum value
  2. Wait for DNS TTL to update
  3. Copy keys / certificates to new server
  4. Put site to maintenance mode
  5. Synchronise files/database to new server
  6. Set up reverse proxy from old server to new server
  7. Remove maintenance mode on new server
  8. Change DNS entries to point to new server

Step 6 ensures that end users don’t end up to the old server even though their DNS has resolved to the old server IP.

After this, keep monitoring the old server logs to see when traffic has stopped there. Then you can dismantle the old setup.

Reverse proxy is set up using proxy_pass directive. If end user IP address is important information, you need to add it into HTTP headers on the old server -> new server requests, and tell new server to use the header value as the IP address.