Apache无法重新启动-loadbalancer

时间:2020-11-10 09:06:42

标签: apache

嗨,我的centos7遇到了这个问题

[root@serverone httpd]# apachectl -M
AH00526: Syntax error on line 3 of /etc/httpd/conf.d/lb.conf:
Invalid command '{%', perhaps misspelled or defined by a module not included in the server configuration

我将lb.conf文件放在/etc/httpd/conf.d/lb.conf-

ProxyRequests off
<Proxy balancer://webcluster >
{% for hosts in groups['webservers'] %}
        BalancerMember http://{{ hostvars[hosts]['ansible_host'] }}
{% endfor %}
        ProxySet lbmethod=byrequests
</Proxy>

#optional
<Location /balancer-manager>
        SetHandler balancer-manager
</Location>

ProxyPass /balancer-manager !
ProxyPass / balancer://webcluster/

,当我尝试重新启动服务时,出现上述错误:

● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2020-11-10 10:20:24 IST; 6s ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 4081 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS)
  Process: 5160 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 5160 (code=exited, status=1/FAILURE)

Nov 10 10:20:24 serverone.example.com systemd[1]: Starting The Apache HTTP Server...
Nov 10 10:20:24 serverone.example.com httpd[5160]: AH00526: Syntax error on line 3 of /etc/httpd/conf.d/lb.conf:
Nov 10 10:20:24 serverone.example.com httpd[5160]: Invalid command '{%', perhaps misspelled or defined by a module not included in the server configuration
Nov 10 10:20:24 serverone.example.com systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Nov 10 10:20:24 serverone.example.com systemd[1]: Failed to start The Apache HTTP Server.
Nov 10 10:20:24 serverone.example.com systemd[1]: Unit httpd.service entered failed state.
Nov 10 10:20:24 serverone.example.com systemd[1]: httpd.service failed.

0 个答案:

没有答案