Problems getting NginX to cache

Maxim Dounin mdounin at mdounin.ru
Sun Mar 28 04:33:12 MSD 2010


Hello!

On Sat, Mar 27, 2010 at 12:40:28PM +0000, Mike wrote:

> I've been trying to setup NginX as a frontend cache for a webserver.
> This is rather challenging, as the documentation is a little flakey but
> it does look like it should be fairly straight forward.  The reverse
> proxing is working just fine, it just doesn't cache anything.  This is
> on version nginx version: nginx/0.7.65

[...]

> The following to server {}:
> 
>     proxy_buffering on;
>     proxy_store          on;
>     proxy_store_access   user:rw  group:rw  all:r;
>     proxy_set_header  X-Real-IP  $remote_addr;
>     proxy_set_header  Host       $host;
> 
> And the following to location {}:
> 
>     proxy_cache            my-cache;
>     proxy_cache_valid       200;

[...]

Directives proxy_store and proxy_cache can't be used at the same 
time, while in your config proxy_store is inherited from server 
level - so effectively you have both of them switched on in the 
location.

It's the bug that nginx doesn't reject such configuration as 
invalid.

Adding "proxy_store off;" to your location with proxy_cache (or 
just removing it from server block) will resolve your problem.

Maxim Dounin



More information about the nginx mailing list