HAProxy "503 Service Unavailable" for webserver running on a KVM virtual machine

Posted by Menda on Server Fault See other posts from Server Fault or by Menda
Published on 2012-10-02T07:51:35Z Indexed on 2012/10/02 9:40 UTC
Read the original article Hit count: 381

Filed under:
|
|

I'm setting up a server with KVM (IP 192.168.0.100) and I have created inside of it one virtual machine using network bridging at 192.168.0.194. This virtual machine has an nginx instance running, which I can access from the server or from any computer computer in the internal network just typing in the browser http://192.168.0.194.

However, I try configure HAProxy in the same server that hosts KVM and looking the status page of HAProxy it always shows the virtual machine as "DOWN". If I try from the server http://localhost, it should be the same than if I go to http://192.168.0.194. My goal is to build a reverse proxy, but I tried this little example and won't work. What am I doing bad?

This is my config file in the server:

# /etc/haproxy/haproxy.cfg
global
        maxconn 4096
        user haproxy
        group haproxy
        daemon

defaults
        log     global
        mode    http
        option  httplog
        option  dontlognull
        retries 3
        option  redispatch
        maxconn 2000
        contimeout      5000
        clitimeout      50000
        srvtimeout      50000

listen ServerStatus *:8081
        mode    http
        stats   enable
        stats   auth haproxy:haproxy

listen Server *:80
       mode http
       balance roundrobin
       cookie JSESSIONID prefix
       option httpclose
       option forwardfor
       option httpchk HEAD /check.txt HTTP/1.0
       server mv1 192.168.0.194:80 cookie A check

Thanks.

© Server Fault or respective owner

Related posts about nginx

Related posts about kvm-virtualization