本文介绍了Squid - 监听多个端口并转发到不同的代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想设置一个代理来监听多个端口,每个端口将请求转发给不同的代理,例如:

I would like to setup a proxy that listens for multiple ports and each port forwards the requests to different proxies, for example:

LISTEN          FORWARD TO
1.2.3.4:3128 -> 5.6.7.8:3128
1.2.3.4:3129 -> 5.6.7.9:3128
1.2.3.4:3130 -> 5.6.7.10:3128

这可以用鱿鱼实现吗?

到目前为止我已经配置了这个:

I have configured this so far:

cache_peer 5.6.7.8 parent 3128 0000 default no-query no-digest
cache_peer 5.6.7.9 parent 3128 0000 default no-query no-digest
cache_peer 5.6.7.10 parent 3128 0000 default no-query no-digest

http_port 3128
http_port 3129
http_port 3130

我不知道如何处理重定向

I don't know how to handle the redirection

推荐答案

您缺少 cache_peer_access 和 acl.

You are missing cache_peer_access and the acl.

试试这个配置:

acl port_1 localport 3128
acl port_2 localport 3129
acl port_3 localport 3130 # I woudn't use this one, This is reserved for ICP

http_port 3128
http_port 3129
http_port 3130

cache_peer 5.6.7.8 parent 3128 0 name=host_1
cache_peer 5.6.7.9 parent 3128 0 name=host_2
cache_peer 5.6.7.10 parent 3128 0 name=host_3

cache_peer_access host_1 allow port_1
cache_peer_access host_2 allow port_2
cache_peer_access host_3 allow port_3

never_direct allow all # Tells your squid to never use its own internet connection to process the requests. If your parent proxy won't work it will return an Error.

GL!

这篇关于Squid - 监听多个端口并转发到不同的代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-08 05:40