简体   繁体   English

Apache HTTPD ProxyRemote和Balancer?

[英]Apache HTTPD ProxyRemote and Balancer?

browser (IE) -> apache httpd proxy -> Proxy 1  -> target url
                                      Proxy 2  -> target url
                                      Proxy n  -> target url

So basically I want to make my own apache httpd proxy that works as a loadbalancer between choosing external proxy setup'ed in httpd conf. 因此,基本上我想创建自己的apache httpd代理,该代理可以在选择httpd conf中设置的外部代理之间充当负载平衡器。

Current setup: 当前设置:

 ProxyPreserveHost On
 ProxyRequests On
 ProxyVia On
 ProxyRemote * http://proxy_ip:80

This version works nicely but I can't figure out how to add several proxy's to ProxyRemote? 这个版本很好用,但是我不知道如何向ProxyRemote中添加几个代理? ... seems not working when setuping as: ProxyRemote * balancer://mycluster ...设置为ProxyRemote * balancer:// mycluster时似乎不起作用

Any ideas? 有任何想法吗? Can it be achieved with apache or some other load balancer should be used? 可以使用apache来实现,还是应该使用其他负载平衡器?

Perhaps I'm a bit too late to help you, but it seems there is no clear answer elsewhere to your question, so this could be useful in the future. 也许我为时已晚,无法为您提供帮助,但是似乎您的问题在其他地方都没有明确的答案,因此将来可能会有用。

Unfortunately the answer is you cannot achieve this kind of load balancing with Apache: as per the Apache documentation ( https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxyremote ) the ProxyRemote directive only supports http and https schemas, not balancer:// 很不幸,答案是你不能达到这种负载与Apache平衡:根据Apache文档( https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxyremote )的ProxyRemote指令只支持httphttps模式,而不是balancer://

Cannot really figure out why the Apache developers didn't consider this configuration, tough, since I found a patch for mod_proxy.c ( http://apache-http-server.18135.x6.nabble.com/attachment/4777809/0/ProxyRemote-Balancer.patch ) which seems to do the trick by essentially just adding the balancer:// schema to the list of matched protocols. 由于我找到了mod_proxy.c的补丁( http://apache-http-server.18135.x6.nabble.com/attachment/4777809/0, /ProxyRemote-Balancer.patch )似乎可以解决这个问题,实际上只是将balancer://模式添加到匹配协议列表中。

如果您在映射到平衡器的代理服务器上设置了另一个虚拟主机,然后通过

ProxyRemote * http://balancer-proxy.vhost.local

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM