Nginx + memcached_pass but nothing caching?

Rajeev J Sebastian rajeev.sebastian at
Sun Feb 1 10:40:10 MSK 2009

On Sun, Feb 1, 2009 at 1:00 PM, Mitchua Mitchua <lists at> wrote:
> Hi!
> I'm trying to use Nginx as a proxy to cache static files off the backend
> servers.  I got nginx and memcached up and running on Fedora core, and I
> can configure it so that it serves the right files.  However, I can't
> find any evidence that it is caching anything.  I've tried setting
> various http headers on the files going through the proxy
> (Cache-control: max-age=600,public)
> The configuration looks like this which is totally vanilla:
> server {
>    location / {
>        set  $memcached_key  $uri;
>        memcached_pass   name:11211;
>        default_type     text/html;
>        error_page       404 = /fallback;
>    }
>    location = /fallback {
>        proxy_pass       backend;
>    }
> }
> "backend" is a LAMP server sitting on a different machine and responding
> on port 80.  If I look at memcached stats, nothing is going into the
> cache but looks of lookups are happening.
> Am I missing a step where I put results from proxy_pass into the cache?
> What is preventing nginx from putting anything into cache?
> Thanks so much for your help!

I dont think nginx itself will put anything into cache. Its the
responsibility of upstream servers to do that, I believe.

Rajeev J Sebastian

More information about the nginx mailing list