Fastcgi caching

I’m using the following config to cache only /piwik/piwik.php:

fastcgi_cache_path /var/cache/php-fpm levels=1:2 keys_zone=piwik:10m;

fastcgi_cache_key “$scheme$request_method$host$request_uri”;

location /piwik/piwik.php {
fastcgi_cache piwik;
add_header X-Cache $upstream_cache_status;
fastcgi_pass unix:/run/php-fpm.socket;
include fastcgi.conf;
}

I’m getting “X-Cache: HIT”. I tried to set up a minimal config, but
am I missing anything essential? Is setting up a manual purge
required or will this manage itself?

  • Grant

Hello!

On Fri, Feb 21, 2014 at 12:00:47PM -0800, Grant wrote:

include fastcgi.conf;

}

I’m getting “X-Cache: HIT”. I tried to set up a minimal config, but
am I missing anything essential? Is setting up a manual purge
required or will this manage itself?

Unless explicitly told to do otherwise, nginx will cache responses
based on validity specified using Expires and/or Cache-Control
headers. That is, if your backend uses headers correctly, no
futher action required.


Maxim D.
http://nginx.org/