Jul 182012

A couple of old jpg’s here, some old css there and the odd old cache-control header, annoying but easily fixed by running:

Nginx clear cache:

cd /to/nginx/cache
grep -lr ‘http://www.website.domain/path/to/file.ext’ *
rm cache/x/yy/zzzzz

The rough equivalent for Varnish:

Varnish clear cache:

varnishadm -S /etc/varnish/secret -T
ban req.http.host == www.website.domain

Eventually decided there must be a cause and effect working somewhere that results in an Nginx cache serving stale content. And google gave me a post containing the following information:

“… if you’re having trouble with Nginx serving up stale static content, and you’re running it in a virtualised environment, try setting sendfile off; in the configuration file (either under that server, or set it globally under http). …”

“… apparently, sendfile doesn’t work so well in virtualised environments like VirtualBox, where our development Vagrant box runs. It doesn’t seem to work properly under Xen either, the environment that our hosting provider Linode uses to give us a virtual private server. …”

For the full explanation read the following informative post.

Reference: http://www.vanpattenmedia.com/2012/a-tale-of-stale-content/

 Leave a Reply

© 2011 Indimon Internet Services

Site last updated April 23, 2022 @ 10:45 am; This content last updated July 18, 2012 @ 10:09 am

Return to Top ▲Return to Top ▲