Forum: NGINX Re: fastcgi_cache_path empty

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
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
  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 topic is locked and can not be replied to.