Not the actual servers – this is a stock photo.

I recently finished moving this website to a new server. I didn’t change the server provider or anything like that, but I wanted to take advantage of some new stuff. Here’s why I did it, and some of the difficulties I encountered.

Why did I do a server migration?

I wanted to upgrade to Ubuntu 18.04 to take advantage of newer PHP and nginx versions. I could have attempted to upgrade from 16.04 to 18.04 in place, but there were a lot of changes between those LTS versions, including how networking is handled. It seemed like the risk was just a little too high. I opted instead to build the system out on a new server, and then move all the website data to the new server. This had a few additional advantages as well:

  • I could switch from MySQL to MariaDB, a community developed version of MySQL that has gained support from several major tech companies. It also supposedly runs faster in some situations.
  • I could simplify my nginx configuration files. For each of my sites, my nginx configuration files are almost identical. Pretty much the only different parts are the server_name, paths to the ssl_certificate and ssl-certificate_key and the root for the website’s files. In building out a new server, I could move almost all of the configuration into snippets, making it easy to make changes to all of the sites at once. This will be useful in the future when some things change (like a newer PHP version).
  • I could entirely remove the andy-bell.com files. For a while I’ve been redirecting andy-bell.com to andybell.xyz, but I was doing so using a WordPress redirection plugin. Since andybell.xyz was literally just cloned from a backup of andy-bell.com, everything’s the same except new stuff. I took the opportunity to just nuke the old files and do the redirect from andy-bell.com to andybell.xyz solely in nginx. This also saved some time, since I wouldn’t need to move the files or database for andy-bell.com.
  • I use acme.sh for my SSL certificates. I was able to slightly improve things as I re-provisioned all the certs on the new server. (I just issued new certs on the new server so I wouldn’t have to move all the old ones over, plus now they will all renew on the same day, which will help me keep track of it better.)

Moving to the new server

It turned out to not be too difficult. Once I got the new server set up with nginx, PHP, and MariaDB, it wasn’t very hard to move all the old files over (I zipped them up on the old server, moved them straight from one server to the other, then unzipped them). Moving the databases wasn’t much harder. The only issue I had with the databases was one particularly large database that I had trouble with due to the file size. It was actually surprisingly smooth. To help ensure the move from one server to another moved quickly, as soon as I knew I wanted to move servers I changed the TTL (Time to Live) on my DNS settings to 5 minutes, so that it wouldn’t take too long for the DNS changes to propagate. Then 48 hours after I completed the move I turned the TTL back to the default setting!

I’m pretty pleased with the server performance, and I’m happy to be running on the latest Ubuntu LTS release. This should help keep things moving quickly and smoothly for years to come!

Summary of the new and old servers

Old Server New Server
Provider Vultr (Seattle) Vultr (Seattle)
OS Ubuntu 16.04 Ubuntu 18.04
Web Server nginx 1.10.3 nginx 1.14.0
PHP PHP 7.0.30 PHP 7.2
Database MySQL MariaDB

(Note: those Vultr links are affiliate links, because I really do like Vultr. If you use either of those links, and are active on Vultr for 30+ days with more than $10 in payments, then I’ll get a $10 credit, which is enough for 2 months of hosting for this site, not including tax.)