Welcome! Log In Create A New Profile

Advanced

Re: nginx simple caching solutions

António P. P. Almeida
August 18, 2012 07:44PM
On 18 Ago 2012 07h10 CEST, ianevans@digitalhit.com wrote:

> Just an update on my situation...
>
> I installed the fastcgi caching as per the suggestions in this
> thread. Using the add_header X-My-Cache $upstream_cache_status;
> line I'm able to confirm by the headers if I'm getting cache hits or
> misses.
>
> I've also got a small handful of directories that I don't want
> cached and as per the thread, they're marked:
>
> map $uri $no_cache_dirs {
> default 0;
> /dir1 1;
> /dir2 1;
> /dir3 1;
> /dir4 1;
> /dir5 1;
> }
>
> In my fastcgi.conf there are the following lines added for the
> caching:
>
> fastcgi_cache MYCACHE; fastcgi_keep_conn on; fastcgi_cache_bypass
> $no_cache $no_cache_dirs; fastcgi_no_cache $no_cache $no_cache_dirs;
> fastcgi_cache_valid 200 301 5m; fastcgi_cache_valid 302 5m;
> fastcgi_cache_valid 404 1m; fastcgi_cache_use_stale error timeout
> invalid_header updating http_500; fastcgi_ignore_headers
> Cache-Control Expires; expires epoch; fastcgi_cache_lock on;
>
> Did a test on some of the no cache dirs (including a wordpress blog)
> and the pages in them were still getting cached. Any ideas why?

Yes, probably you need a regex based map:

So use:

map $uri $no_cache_dirs {
default 0;
~^/(?:dir1|dir2|dir3|dir4|dir5) 1;
}

instead.

--- appa

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

nginx simple caching solutions

Ian M. Evans August 01, 2012 12:26AM

Re: nginx simple caching solutions

姚伟斌 August 01, 2012 12:34AM

Re: nginx simple caching solutions

Ian M. Evans August 01, 2012 12:50AM

Re: nginx simple caching solutions

António P. P. Almeida August 01, 2012 02:54AM

Re: nginx simple caching solutions

Mark Alan August 01, 2012 04:46AM

Re: nginx simple caching solutions

Ian Evans August 01, 2012 09:04AM

Re: nginx simple caching solutions

António P. P. Almeida August 01, 2012 09:14AM

Re: nginx simple caching solutions

Ian Evans August 01, 2012 11:20AM

Re: nginx simple caching solutions

António P. P. Almeida August 01, 2012 11:28AM

Re: nginx simple caching solutions

Ian Evans August 01, 2012 11:44AM

Re: nginx simple caching solutions

Ian Evans August 18, 2012 01:12AM

Re: nginx simple caching solutions

António P. P. Almeida August 18, 2012 07:44PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 149
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready