Debugging FastCGI caching

Daniel15 nginx-forum at nginx.us
Sun Jan 27 12:12:59 UTC 2013


I'm trying to use Nginx FastCGI caching to cache my site's home page and
blog home page. However, caching doesn't seem to be working on these pages,
and $upstream_cache_status always seems to be "MISS".

Site URL: http://dan.cx/

Relevant bits of the config (and the full Nginx server{} config is available
at https://github.com/Daniel15/Website/blob/master/nginx.conf):
_________________________________________________
# Handles only caching certain URLs
map $uri $dan_no_cache {
	default 1;
	~^/bundles/ 0;
	/ 0;
	/blog 0;
}
...
# Caching parameters
fastcgi_cache_key "$scheme$host$request_uri";
fastcgi_cache DANIEL15;
fastcgi_cache_valid 60m;
		
# Don't cache if $dan_no_cache map evaluates to 1
fastcgi_cache_bypass $dan_no_cache;
fastcgi_no_cache $dan_no_cache;
# Add cache status as X-Cache header
add_header X-Cache $upstream_cache_status;
_________________________________________________

Files under /bundles/ are correctly cached (see eg. the CSS and JavaScript
on the site). I've noticed that $upstream_cache_status is "BYPASS" on pages
that shouldn't be cached, which makes me think it's correctly picking up
those URIs as being cacheable.

What is the best way to debug this issue?

Thanks!

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,235609,235609#msg-235609



More information about the nginx mailing list