gavd.co.uk

Frail and faltering follower of Jesus

Migrating from Cherokee to Nginx

By Gavin Davies

I’ve just switched web servers from Cherokee to Nginx; here’s how I did it and why…

I’ve just switched web servers from Cherokee to Nginx. It really showed how much I’ve learned in the 3 years since I first started running my own server!

I originally picked Cherokee for a number of reasons:

  • It had good performance
  • It was something a little different

I switched to Nginx because:

  • Development on Cherokee seems to have slowed down a lot
  • Nginx has good performance
  • Nginx is increasingly what I’m using in Ye Olde Day Jobbe
  • Again, it’s something a bit new…
  • … but it’s much easier to get tips from Stack Exchange and so forth!

Now, I’m aware you can get good performance on Apache but I’ve found that Nginx works really well out of the box and I prefer the configuration file format that it uses.

When I initially built the web server, I installed a fair few things from source (including PHP and Cherokee). I won’t ever be doing that again without a very good reason! It’s always sensible to use supported, reliable packages instead of the newest, shiniest things. Canonical and Red Hat generally do a pretty good job of providing stable, reliable gubbins!

Also, in building this new server, I set up the essential security (dead link removed) from the outset, using the article from PlusBryan as well as things I’ve learned from the recent Cardiff Dev Workshop on SysAdmin for Coders.

I didn’t want to simply install nginx on the old server; there was a lot of cruft on that old box. Therefore, I spun up a new Linode and followed this sequence:

  • Lock down the box to a reasonable level – there’s no really security critical stuff on my server but it’s always worth being careful. I’m no expert on sys admin, but I’m always learning about security!
  • Rsync’d across the files from the old server to the new server over an SSL tunnel
  • Exported the databases, rsync’d them, imported them on the new server
  • Set up nginx for all the sites on the new server
  • Created temporary domains to test the sites on the new box
  • Test! Test! Test!
  • Pointed the domains across

Well, it’s so far, so good. Alhthough coding is my bread and butter, I really enjoy doing “server gubbins” and I think that any deployment minded delivery requires engaging with the distribution end. I don’t have a large enough array of sites and servers to warrant a great deal of automation. Most of what it on my server is fairly simple, standard stuff. I’ve still got a lot to learn, which is partly why I organised the sys admin for coders workshop and got Matt in to teach it – believe me, a good sysadmin is like a good drummer – rare, and to be treasured!