Varnish with Wordpress

kevin k at
Tue Jun 28 03:46:27 CEST 2011

> should varnish be expected to act as a complete failure server if the
wp-content directory is removed on the wordpress install. That just happened
to us and were trying to figure out how to get varnish > to continue to
serve up the cached content for 30+ wp sites whose content was removed.

Separate cache times for media might avoid that issue :

        if (req.url ~ ".(gif|jpg|jpeg|png|css|js|java|fla|swf)$") {
                set beresp.http.cache-control = "public, max-age=2592000";
                #include <time.h>
                static char timebuf[30];
                char *format = {"%a, %d %b %Y %H:%M:%S GMT"};
                struct tm timestruct;
                time_t now;
                gmtime_r(&now, &timestruct);
                strftime(timebuf, 30, format, &timestruct);
                VRT_SetHdr(sp, HDR_BERESP, "\010Expires:", timebuf,
                set beresp.ttl = 12h;

Just set "12h" to whatever you want. Also : don't delete your data ;)


More information about the varnish-misc mailing list