大网数据广告活动
服务器运维问答

Configure squid 3.5 to use different parent proxies for different listening ports

· 52CE 我爱测

I have following configuration now: # Squid normally listens to port 3128 http_port 3128 cache_peer proxy1_address parent proxy1_port 0 proxy-only default login=name1:pass1 never_direct allow all Now I need to configure squid in …

问题原文

原帖链接 · bonzaster · CC BY-SA 3.0

I have following configuration now:

# Squid normally listens to port 3128
http_port 3128

cache_peer proxy1_address parent proxy1_port 0 proxy-only default login=name1:pass1
never_direct allow all

Now I need to configure squid in a way when all incoming requests to 3128 will be redirected to proxy1 (as it works now), and all incoming requests to 3127 will be redirected to proxy2. Is it possible to do?

My current configuration is not working:

http_port 3128
http_port 3127

acl port_3128 port 3128
acl port_3127 port 3127

# 3128
cache_peer proxy01 parent 3128 0 no-query originserver name=proxy3128
cache_peer_access proxy3128 allow port_3128
cache_peer_access proxy3128 deny port_3127

# 3127 
cache_peer proxy02 parent 3128 0 no-query originserver name=proxy3127
cache_peer_access proxy3127 allow port_3127
cache_peer_access proxy3127 deny port_3128

社区高分解答

原帖链接 · bonzaster · CC BY-SA 3.0

Thanks for help, finally found working configuration (thanks guys from squid mailing list)

http_port 3128 name=port_3128
http_port 3127 name=port_3127

nonhierarchical_direct off

acl port_3128_acl myportname port_3128
acl port_3127_acl myportname port_3127

always_direct deny port_3128_acl
always_direct deny port_3127_acl

never_direct allow port_3128_acl
never_direct allow port_3127_acl

# 3128
cache_peer proxy1 parent 3128 0 proxy-only default  name=proxy3128
cache_peer_access proxy3128 allow port_3128_acl
cache_peer_access proxy3128 deny all

# 3127 
cache_peer proxy2 parent 3128 0 proxy-only default  name=proxy3127
cache_peer_access proxy3127 allow port_3127_acl
cache_peer_access proxy3127 deny all

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-02-20)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。