Haproxy运行错误?

时间:2012-10-17 06:38:50

标签: ubuntu haproxy

我正在使用HA-Proxy版本1.3.22和Ubuntu 10.04。这是我的配置文件。

global
        maxconn     25000  
        daemon
        nbproc      4 



defaults
        mode        http
        clitimeout  60000
        srvtimeout  30000
        contimeout  4000
        timeout http-request 5s  
        option      httpclose 




listen  http_proxy *:80
        #bind *:80
        balance roundrobin 
        option httpchk
        option forwardfor 
        use_backend bk_web_static if { path_end .jpg .png .gif .css .js }
        default_backend bk_web 


backend bk_web  

        balance roundrobin ## change to URL hashing

        server server1 0.0.0.0:3002 weight 1 maxconn 512 check
        server server2 0.0.0.0:3003 weight 1 maxconn 512 check
        server server3 0.0.0.0:3004 weight 1 maxconn 512 check



backend bk_web_static
  balance roundrobin
        server server1 0.0.0.0:3002 weight 1 maxconn 1000 check
        server server2 0.0.0.0:3006 weight 1 maxconn 1000 check
        server server3 0.0.0.0:3007 weight 1 maxconn 1000 check

运行haproxy时出现以下错误。我在网上找到了这个配置代码。我猜这段代码是针对一些最新版本的。请告诉我运行haproxy服务器后我做了哪些更改..

 [ALERT] 290/100612 (2745) : parsing [/etc/haproxy/haproxy.cfg:24] : error detected while parsing switching rule.
[ALERT] 290/100612 (2745) : Error(s) found in configuration file : /etc/haproxy/haproxy.cfg
[ALERT] 290/100612 (2745) : Fatal errors found in configuration. 

1 个答案:

答案 0 :(得分:0)

在听取会话中尝试使用此配置文件:

listen  http_proxy *:80
        balance roundrobin 
        option httpchk
        option forwardfor 

        acl is_static path_end -i .jpg .png .gif .css .js 
        use_backend bk_web_static if is_static

        default_backend bk_web