Squid server - multiple originservers with different domains
I have 2 squid servers load-balanced with F5 LTMs set up as a reverse proxy.
My problem:
origin server A hosts domains 1, 2, and 3 origin server B hosts domains 4 and 5.
how can I set up squid so that it will cache all vhosts for both serv开发者_如何学运维ers?
my current config:
cache_peer serverA parent 80 0 round-robin no-query originserver login=PASS
If I add a second line:
cache_peer serverB parent 80 0 round-robin no-query originserver login=PASS
it only caches domains on serverB, requests for serverA content generate 404 errors.
I don't use squid a whole lot, and all help is appreciated. thanks.
There are a few ways to do this (e.g., with a rewriter), but probably the easiest is cache_peer_domain:
http://www.squid-cache.org/Versions/v2/2.7/cfgman/cache_peer_domain.html
E.g., you'd have something like
cache_peer serverA parent 80 0 round-robin no-query originserver login=PASS
cache_peer_domain serverA domain1 domain2 domain3 !domain4 !domain5
cache_peer serverB parent 80 0 round-robin no-query originserver login=PASS
cache_peer_domain serverB !domain1 !domain2 !domain3 domain4 domain5
For a bit more control, see cache_peer_access:
http://www.squid-cache.org/Versions/v2/2.7/cfgman/cache_peer_access.html
精彩评论