Apache ProxyPass负载平衡所有URL的
问题描述:
使用Apache HTTP Server,我如何负载均衡所有的URL,不仅仅是root /“/”或像“/ css”这样的根目录下的一些子目录,但绝对是平衡后端的一切?Apache ProxyPass负载平衡所有URL的
我的配置只会路由文字根URL“/”但其他URL的不覆盖,我需要使用正则表达式吗?
相关配置:
<Proxy balancer://mycluster>
BalancerMember https://server1:8443
BalancerMember https://server2:8443
ProxySet lbmethod=byrequests
</Proxy>
<VirtualHost _default_:443>
SSLProxyEngine on
ProxyPass "/" "balancer://mycluster"
ProxyPassReverse "/" "balancer://mycluster"
</VirtualHost>
的Apache的access_log(通知/ CSS的接收500响应):
172.18.0.1 - - [10/May/2017:20:22:55 +0000] "GET/HTTP/1.1" 200 196
172.18.0.1 - - [10/May/2017:20:22:58 +0000] "GET /css HTTP/1.1" 500 528
的Apache的error_log:
[Wed May 10 20:22:58.607433 2017] [proxy:warn] [pid 9:tid 140682836559616] [client 172.18.0.1:35304] AH01144: No protocol handler was valid for the URL /css. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.
答
的ProxyPass/....是足以代理所有内容,但要确保匹配斜杠,指定“balancer:// mycluster”不正确,并且您需要ma TCH斜线来回,所以如果你的原产地在斜线结束的目标也结束斜杠,加上在这种情况下平衡器:// myCluster中真的平衡器:// myCluster中/
ProxyPass/balancer://mycluster/
奇,我是有这样的之前,它没有工作。现在呢!谢谢 – szxnyc