nginx simple caching solutions
Ian Evans
ianevans at digitalhit.com
Sat Aug 18 05:10:01 UTC 2012
Just an update on my situation...
I installed the fastcgi caching as per the suggestions in this thread.
Using the add_header X-My-Cache $upstream_cache_status; line I'm able to
confirm by the headers if I'm getting cache hits or misses.
I've also got a small handful of directories that I don't want cached
and as per the thread, they're marked:
map $uri $no_cache_dirs {
default 0;
/dir1 1;
/dir2 1;
/dir3 1;
/dir4 1;
/dir5 1;
}
In my fastcgi.conf there are the following lines added for the caching:
fastcgi_cache MYCACHE;
fastcgi_keep_conn on;
fastcgi_cache_bypass $no_cache $no_cache_dirs;
fastcgi_no_cache $no_cache $no_cache_dirs;
fastcgi_cache_valid 200 301 5m;
fastcgi_cache_valid 302 5m;
fastcgi_cache_valid 404 1m;
fastcgi_cache_use_stale error timeout invalid_header updating http_500;
fastcgi_ignore_headers Cache-Control Expires;
expires epoch;
fastcgi_cache_lock on;
Did a test on some of the no cache dirs (including a wordpress blog) and
the pages in them were still getting cached. Any ideas why?
Thanks. Hope you all have great weekends.
More information about the nginx
mailing list