Reverse Cache for Multiple Sites
Maxim Dounin
mdounin at mdounin.ru
Mon Jun 6 00:47:16 MSD 2011
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 Dounin
More information about the nginx
mailing list