两个鱿鱼链

我有两个鱿鱼服务器,Squid A和Squid B.

鱿鱼一个透明的caching为本地networking。

我想设置Squid A,以便在请求一个匹配正则expression式的URL时,而不是像往常一样提供请求,它通过Squid B“redirect”,以便Squid B服务请求,将结果传递回Squid A通过它到客户端。

如何设置Squid A的configuration文件来做到这一点?

在squid中使用以下configuration(通常是/etc/squid/squid.conf)

cache_peer <squid server B IP> parent <server B squid port> 3130 no-query no-digest no-netdb-exchange acl otherproxy url_regex "/etc/squid/divert.txt" cache_peer_access <Squid server B IP> allow otherproxy never_direct allow otherproxy cache_peer_access <squid server B IP> deny all 

而在其他acls顶部的鱿鱼乙configuration

 acl A_proxy src <Squid server A IP>/32 http_access allow A_proxy 

之后,你可以添加正则expression式文件/etc/squid/divert.txt和重新加载鱿鱼。 将从服务器B请求匹配的URL,而不是直接。

我之所以提到在代理B上增加acl也是为了避免在代理B上影响代理A的客户端的身份validation,连接限制等设置,因为这样的问题很难debugging。 所以最好是允许代理A的所有请求到代理B.如果你想在两个代理configuration中阻止它的阻塞。

你需要在squid A的squid.conf中使用以下内容。 以此为例,调整以适应您的具体要求。

 #定义squid B作为父母
 cache_peer squid.b.example.com父母3128 3130默认

 #为您的任何域或IP地址范围创buildACL
 #不想从父母(鱿鱼B)获得。 例如:
 acl local_domains domain your.local.domains.here
 acl local_ip dst your.local.ip.addresses.here
 always_direct_allow local_domains
 always_direct允许local_ip

 #并拒绝直接访问其他任何东西
 never_direct全部允许

鱿鱼具有支持代理服务器层级结构的function。 鱿鱼手册页有关于这个话题的优秀文档。