# Re: fastcgi\_cache\_path empty

**URL:** <https://www.ruby-forum.com/t/re-fastcgi-cache-path-empty/238567>\
**Category:** NGINX\
**Created:** [January 17, 2014, 1:14am UTC](https://www.ruby-forum.com/t/re-fastcgi-cache-path-empty/238567 "2014-01-17T01:14:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [January 17, 2014, 1:14am UTC](https://www.ruby-forum.com/t/re-fastcgi-cache-path-empty/238567/1 "2014-01-17T01:14:14Z")

</div>

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?
