Article

9 Steps for Moving Sites Between Servers

9steps

Technical needs change over time. To have a better optimized website, this may mean migrating your website to a different server. Perhaps you’ve found a server more conducive to efficiency and performance, and you need guidance about how to switch.

While it may seem like more hassle than it’s worth, moving your site isn’t as difficult as it seems. By following a few simple steps you can avoid the data loss and downtime that may be standing as an unnecessary barrier between you and doing what’s right for your website and your business.

1. Ensure Compatibility with the New Hosting Environment

Ensure the new hosting environment will provide sufficient bandwidth, disk space, visitor limits, etc. Some hosts disallow certain code on their hosts e.g. the WP Engine Disallowed Plugins.

Inventory everything that needs to be moved. Other than your website, are there cron jobs, background processes, or other code which also need to be migrated?

2. Prep & Test New Server

Set everything up on the new server. Use your hosts file to test the new server with your production domain. Remember to copy over non-versioned server files such as crontabs, SSH authorized keys, and SSL certificates and keys. Consider moving a staging site to the new host first.

3. Lower Your DNS TTL

DNS records are usually cached based on their Time To Live or TTL values. To ensure that clients see the updated DNS records as soon as possible after the server move, lower the DNS TTLs to 300 seconds (or their lowest possible setting, if higher) at least two days before the server move.

4. Content Freeze & Maintenance Mode

Any changes made to the site on the old server after the final database backup is taken won’t make it to the new server. To prevent changes from being made on the old server, put the site in maintenance mode to ensure nothing new is written to the database. Ensure the client is aware that they won’t be able to make changes to the site and that the site will be down for all customers during this time.

5. Move Data

Once you’re sure there won’t be any further changes to the site or the data, take one last backup of the old site and move the data to the new server. Sometimes changes are limited to the database but often other non-versioned files (e.g. images, config files) will need to be moved as well. Load up the data on the new site. Be sure to check the file and directory ownership and permissions on the new server.

6. Handle Traffic on Old Server

Some clients do not respect DNS TTLs and will continue to route traffic to your old server even after the DNS has been updated. Decide how you will handle traffic hitting your old server. Do you want to shut down the server so that clients see an error page? Keep the site in maintenance mode? Set up the old server to proxy traffic to the new server?

7. Update DNS

Once everything is ready, update the DNS to point to the domain name to the new server. Be sure to update all records referring to the old server affected by the move.

8. Other Considerations

If the current server is acting as a DNS server then the IP address of the server will also need to be updated with the domain name registrar. If the current hosting provider is providing DNS then that will need to be migrated as well.

If your server sends email then your sending IP (with its associated reputation) will also be changing. You’ll need to update the reverse DNS PTR record with the new web hosting provider to ensure that email continues to be delivered. Consider using a third-party SMTP server like MailGun instead.

Consider where else your old server IP address may be used; these will need to be updated as well. Common places you might find hard coded IP addresses include firewalls and API whitelists.

9. Deprovision Old Server

After some time the old server should be deprovisioned. Disable any backups or monitoring associated with the old server. Power down the old server. Leave the old server in a shut down state for some time so that it can be powered back on if any need for the server is discovered. Once there is confidence that the old server is no longer needed it can be deprovisioned.

What’s Next?

Interested in building a website? Or in migrating your existing website to a new server? Give us a call!

Steve-Hulet-Default-BW_optimize.jpg

Steve Hulet

CIO

Steve is the Co-Founder and CIO at Fresh. A former Software Engineer at Amazon with over 12 years of web development experience, Steve provides technical, architectural, and engineering oversight to projects. Steve is responsible for all technology reviews related to websites. His specialities include programming languages such as C, C++, Java, Python, and PHP, and technology software including Eclipse, GLPK, jQuery, Linux, and MATLAB. Steve’s skills include automation, databases, linear programming, optimization, and testing, all of which he uses in conjunction with Fresh’s digital strategists provide innovative solutions to clients.