I have a website I need to mount and I'm doing so with an HAproxy as load balancer, 3 webservers, 1 memcached, another HAproxy and a mysql galera cluster with 3 servers. All in CentOS 7.

Anyway I mounted the website with Nginx and the developers told me to do it with Apache, so I unistalled Nginx and put Apache. Now HAproxy wont see my webserver and is listing it as timeout in the monitor ui, and ofcourse I get timeout if I try to access the website.

Here's my HAproxy configuration:

    log local2
    chroot  /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     4000
    user        haproxy
    group       haproxy

    # turn on stats unix socket
    stats socket /var/lib/haproxy/stats

    log     global
    mode    http
    option  httplog
    option  dontlognull
    timeout connect 5000
    timeout client  50000
    timeout server  50000

frontend apache-webservers
    bind *:80
    mode http
    default_backend apache-nodes

backend apache-nodes
    mode http
    balance roundrobin
    option forwardfor
    http-request set-header X-Forwarded-Port %[dst_port]
    http-request add-header X-Forwarded-Proto https if { ssl_fc }
    option httpchk HEAD / HTTP/1.1\r\nHost:www.mysite.com
    server web1 check
#   server web2 check
#   server web3 check

listen stats *:1935
    stats enable
    stats uri /

stats hide-version
stats auth monitor:mypassword

I installed links in my webserver and I can browse the site perfectly. The problem is through HAproxy. The funny thing is thet in my HAproxy server I can connect to the webserver using telnet perfectly.

In my webserver I have both firewalld and selinux disabled for now, so it's not an access problem.

What can be happening here? Why it worked while I have Nginx and not now with Apache?

Thanks in advance.

  • If you check the HAproxy stats page, what is the status of the backend? – wurtel May 6 '15 at 9:18
  • HAproxy says "level 7 timeout". Another curious thing is that with links installed in the HAproxy server I actually can browse the website. – Alain May 6 '15 at 13:36
  • Level 7 timeout means it can connect, it's just not getting an answer... There's usually a space between Host: and the hostname, add it to your httpchk line (i.e. option httpchk HEAD / HTTP/1.1\r\nHost:\ www.mysite.com) – wurtel May 6 '15 at 14:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.