Reverse Cache for Multiple Sites

I am looking to implement NGINX as a reverse proxy cache for a number
of sites, there are 6 fairly busy sites between 4 webservers. I can
find plenty of online assistance in configuring NGINX to reverse cache
a single site from a single origin. I appear to be struggling to find
how to configure a single NGINX installation to reverse cache multiple
sites from multiple origins.

Could anyone point me in the right direction on this, or am I overly
complicating a simple config?

Thanks in advance,

John

Hello!

On Sun, Jun 05, 2011 at 07:04:09PM +0100, John Macleod wrote:

I am looking to implement NGINX as a reverse proxy cache for a number
of sites, there are 6 fairly busy sites between 4 webservers. I can
find plenty of online assistance in configuring NGINX to reverse cache
a single site from a single origin. I appear to be struggling to find
how to configure a single NGINX installation to reverse cache multiple
sites from multiple origins.

Could anyone point me in the right direction on this, or am I overly
complicating a simple config?

Just define multiple servers and configure them. See here for
details:

http://nginx.org/en/docs/http/request_processing.html
http://wiki.nginx.org/HttpCoreModule#server

Something like this should work:

proxy_cache_path /path/to/cache keys_zone=one:10m;

server {
    listen ...
    server_name site1.example.com;

    location / {
        proxy_pass http://site1.backend;
        proxy_cache one;
    }
}

server {
    listen ...
    server_name site2.example.com;

    location / {
        proxy_pass http://site2.backend;
        proxy_cache one;
    }
}

Maxim D.