Proxying and caching a fragile server to ensure availability
B.R.
reallfqq-nginx at yahoo.fr
Thu Aug 22 02:23:56 UTC 2013
Hello,
On Wed, Aug 21, 2013 at 9:42 PM, cachito <nginx-forum at nginx.us> wrote:
> if ($http_cookie ~*
> "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") {
> set $no_cache 1;
> }
>
If the user sends requests using cookies from Wordpress, the cache won't
be used...
Thus, you seem not to cache requests from Wordpress at all. That CMS need
resources such as power and generates huge traffic (that needs to be
processed aswell).
Are you sure not all the Wordpress requests contain cookie(s)?
> #The different cache zones reside in different filesystems. the "pages"
> zone
> is saved in RAM for fast delivery.
> location / {
> proxy_pass http://upstream;
> proxy_cache pages;
> proxy_cache_key $cache_key;
> proxy_cache_valid 60m; # I was hoping to have the proxy query the
> upstream once every hour for updated content.
>
Read the correct syntax and use of proxy_cache_valid.
If no HTTP code is specified as optional parameter, it says 'then only 200,
301 and 302 responses are cached'.
> # 2 rules to dedicate the no caching rule for logged in users.
> proxy_cache_bypass $no_cache; # Do not cache the response.
> proxy_no_cache $no_cache; # Do not serve response from cache.
>
Actually, those 2 comments are inverted: proxy_no_cache controls whether
or not items should be written in cache and proxy_cache_bypass controls
whether or not content should be read from it.
> add_header X-Cache $upstream_cache_status;
> expires 60m;
> }
>
---
*B. R.*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20130821/31d2eae4/attachment.html>
More information about the nginx
mailing list