Forum: NGINX Re: fastcgi_cache_path empty

Dc4a52fae8f8e18ad444d0a6c409f239?d=identicon&s=25 Lorenzo Raffio (Guest)
on 2014-01-17 01:14
(Received via mailing list)
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?
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.