Re: fastcgi_cache_path empty

Thanks Steve for the reply!!

Ok, so tell me if I understood correcty. You just have in your “vhost”
server block this:
fastcgi_cache_path /var/cache/nginx levels=1:2 keys_zone=microcache:10m
max_size=1000m inactive=60m;

and then you have a file /etc/nginx/microcache with

Setup var defaults

set $no_cache “”;

If non GET/HEAD, don’t cache & mark user as uncacheable for 1 second

via cookie
if ($request_method !~ ^(GET|HEAD)$) {
set $no_cache “1”;
}

Drop no cache cookie if need be

(for some reason, add_header fails if included in prior if-block)

if ($no_cache = “1”) {
add_header Set-Cookie “_mcnc=1; Max-Age=2; Path=/”;
add_header X-Microcachable “0”;
}

Bypass cache if no-cache cookie is set

if ($http_cookie ~* “_mcnc”) {
set $no_cache “1”;
}

Bypass cache if flag is set

fastcgi_no_cache $no_cache;
fastcgi_cache_bypass $no_cache;
fastcgi_cache microcache;
fastcgi_cache_key “$scheme$request_method$host$request_uri
$http_if_modified_since$http_if_none_match”;
fastcgi_cache_valid 404 30m;
fastcgi_cache_valid 200 10s;
fastcgi_max_temp_file_size 1M;
fastcgi_cache_use_stale updating;
fastcgi_pass_header Set-Cookie;
fastcgi_pass_header Cookie;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;

… correct?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs