Varnish with Wordpress

kevin k at kevinkevin.com
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";
                 C{
                #include <time.h>
                static char timebuf[30];
                char *format = {"%a, %d %b %Y %H:%M:%S GMT"};
                struct tm timestruct;
                time_t now;
                time(&now);
                now+=2592000;
                gmtime_r(&now, &timestruct);
                strftime(timebuf, 30, format, &timestruct);
                VRT_SetHdr(sp, HDR_BERESP, "\010Expires:", timebuf,
vrt_magic_string_end);
                }C
                set beresp.ttl = 12h;
                return(deliver);
        }




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

~kevin








More information about the varnish-misc mailing list