我正在尝试在CentOS 7.3 VM上使用Apache Httpd 2.4.6配置负载均衡器。但是," apachectl configtest"失败并显示错误消息
AH00526: Syntax error on line 32 of /etc/httpd/conf/httpd.conf:
BalancerMember Bad syntax for a balancer name
虽然 已加载mod_proxy_http(因此http://192.168.56.2:5555应包含有效协议),但语法与我找到的示例中的语法相符。
关于什么是错的任何想法?我的httpd.conf如下所示:
ServerRoot "/etc/httpd"
Listen 5555
LoadModule unixd_module modules/mod_unixd.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so
LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
LoadModule status_module modules/mod_status.so
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
User apache
Group apache
ServerAdmin my.email@my.domain.com
ServerName center.mcjwi01.eur.ad.sag:5555
<Directory />
AllowOverride none
Require all denied
</Directory>
LogLevel debug
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
CustomLog "logs/access_log" combined
AddDefaultCharset UTF-8
<Proxy "balancer:iscluster">
BalancerMember http://192.168.56.2:5555
BalancerMember http://192.168.56.3:5555
ProxySet lbmethod=bybusiness
</Proxy>
ProxyPass "/" "balancer:iscluster"
ProxyPassReverse "/" "balancer:iscluster"
答案 0 :(得分:1)
确切地说,语法是错误的,正确的应该是:
<Proxy balancer://iscluster>
BalancerMember http://192.168.56.2:5555
BalancerMember http://192.168.56.3:5555
ProxySet lbmethod=bybusiness
</Proxy>
ProxyPass / balancer://iscluster/
ProxyPassReverse / balancer://iscluster/
注意:我删除了&#34;因为afaik它们并不是真正必要的,所以我也匹配拖尾斜线以避免代理问题。