Welcome! Log In Create A New Profile

Advanced

Debugging FastCGI caching

January 27, 2013 07:12AM
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!
Subject Author Posted

Debugging FastCGI caching

Daniel15 January 27, 2013 07:12AM

Re: Debugging FastCGI caching

Francis Daly January 27, 2013 07:34AM

Re: Debugging FastCGI caching

Daniel15 January 28, 2013 01:28AM

Re: Debugging FastCGI caching

Maxim Dounin January 28, 2013 03:52AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 142
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready