nginx + Ghost cache issues.

TL;DR: If after modifying theme files or posts and the changes don't see the changes reflected when browsing the blog, make sure sendfile is turned off in your nginx configuration.

Yesterday I moved this blog from Rackspace to DigitalOcean. It was a very quick and smooth process, since DigitalOcean, pretty much like Rackspace, provides a quick way to setup a machine running Ghost (although not the last version) with just a few clicks.

digital ocean apps

Since the machine is supposed to be ready to work just fine out of the box I didn't do much tweaking to the nginx configuration, until I came up with a problem. After modifying Ghost's default theme, Casper, and restarting both the ghost and nginx services I couldn't see the changes reflected in the browser. Even more, the same problem would happen after making changes to the posts, which are stored in a Postgresql database.

After some googling I came up with someone facing a similar problem in StackOverflow. The accepted answer pointed a pretty straight forward solution that consists in turning off sendfile in the nginx configuration, which I did so. After restarting the service all the changes started to reflect immediatly!

Author image
Santiago, Chile Website
Web developer for the last 4 or so years, Mauricio tries hard to stand out and go beyond his limits, which usually doesn't work very well, but when it does it feels awesome!