I've setup FastCGI cache like this:
location ~ \.php(/.*)?$ {
fastcgi_cache RWI;
fastcgi_cache_valid 200 60m;
set $nocache 0;
if ($request_method = POST)
{
set $nocache 1;
}
if ($http_cookie ~ (rwi_userid*|rwi_password*)) {
set $nocache 1;
}
if ($request_uri ~* "/(vb/admincp/)") {
set $nocache 1;
}
fastcgi_no_cache $nocache;
fastcgi_cache_bypass $nocache;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass "unix:/var/www/vhosts/system/{domain}/php-fpm.sock";
include /etc/nginx/fastcgi.conf;
}
And on top of the server{}
block I have:
fastcgi_cache_path /var/cache/nginx levels=1:2 keys_zone=RWI:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
add_header X-Cache $upstream_cache_status;
Problem is my PHP script (vBulletin) is always sending a Pragma & Cache-Control private
. Is there any way to ignore those headers and force FastCGI to use cache when the above rules don't apply? I'm kind of lost in this caching possibility.