Click away now if you're not interested in web servers.

Having spent much of the last few years making sure clients’ websites are fast and responsive, I finally got round to sorting my own blog out. It was letting the side down, being quite sluggish and unoptimised in its shared hosing environment. So I've moved this over to my own server which is running Varnish, nginx and also PHP 5.4 with APC.

WordPress, which this blog runs on, works out of the box in Apache + PHP environments but getting it running in nginx (with PHP-FPM) was a bit of a pain in the arse. This is mostly because .htaccess files are an Apache thing so don't work in nginx. nginx has its own syntax for setting up redirects and there are tools out there for converting between the two but none of the ones I found converted my existing rules successfully.

Frustratingly, following these official instructions to the letter did not work either. Getting the main WordPress installation working was fine but the problem was WP Super cache which relies on some specific rewriting logic. Certain valid post URLs were throwing up 404 errors depending on the state of the cache and what characters were in the address. At that point it had reached 1am so I decided as an interim to put Apache on the server too. I'll return to the nginx configuration sometime soon. I have other sites running off this server through nginx, it's just that WordPress-plugin-specific problem that needs solving.

Running Varnish on the server means it's now easy to route traffic to either Apache or nginx as required based on the request hostname and of course it caches the returned documents so speeds things up even more. Ideally I'd have assets going to a CDN but given that I only get a handful of visitors each day it doesn't really seem worth the effort.

Anyway, that's it for dev-ops news. Hopefully this blog will be a bit more responsive from now on.


P.S. OK, so signing in to leave comments is currently broken. This is due to my Varnish configuration. I need to make exceptions for cookies. I'm sure you'll manage in the meantime. <-- Now fixed