Forum: NGINX Nginx + memcached_pass but nothing caching?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Mitchua M. (Guest)
on 2009-02-01 09:30
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!

Cheers,
Mitchua
Rajeev J Sebastian (Guest)
on 2009-02-01 09:48
(Received via mailing list)
On Sun, Feb 1, 2009 at 1:00 PM, Mitchua M. 
<removed_email_address@domain.invalid>
wrote:
> server {
> }
>
> "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.

Regards
Rajeev J Sebastian
This topic is locked and can not be replied to.