Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to launch HA Proxy 1.4.24 on an ubuntu 13 VM via sudo. My haproxy.cfg file is copied below. However, when I use sudo service haproxy start or try sudo /etc/init.d/haproxy start, the process not start up. Any ideas on troubleshooting this would be helpful. The config file appears to pass the configuration test (sudo haproxy -f haproxy.cfg -c results in "Configuration file is valid").
Also, Enabled flag in the haproxy file in /etc/init.d is set to 1. Port 80 does not appear to be bound by any other service.

Update: I had set the enabled flag to 1 in the /etc/init.d/haproxy file as opposed to in the /etc/default/haproxy file - fixing this change allowed me to run haproxy normally.

    maxconn     25000 # Total Max Connections. This is dependent on ulimit
    nbproc      4 # Number of processing cores. Dual Dual-core Opteron is 4 cores for example.

    mode        http
    clitimeout  60000
    srvtimeout  30000
    contimeout  4000
    timeout http-request 5s  # added to tackle slow http requests
        option abortonclose
        option forwardfor

listen  http_proxy *:80
        #bind *:80
    balance roundrobin # Load Balancing algorithm
    option httpchk
    option forwardfor # This sets X-Forwarded-For
        default_backend bk_web

# Dynamic part of the application
backend bk_web
    ## Define your servers to balance
    balance roundrobin ## change to URL hashing
    cookie MYSRV insert indirect nocache  ## check this NOTE TO SELF
    server server1 weight 1 maxconn 512 check
    server server2 weight 1 maxconn 512 check
share|improve this question
Try running haproxy directly with haproxy -f haproxy.cfg -db – Nathan C Dec 10 '13 at 22:29
@Nathan C - the process runs fine when I use haproxy -f haproxy.cfg -db. However, when I try sudo service haproxy start (or sudo /etc/init.d/haproxy start), the process does not launch. Perhaps I should take a closer look at the haporxy file in /etc/init.d – ali haider Dec 10 '13 at 22:42
pilot error - I set the enabled flag in the /etc/init.d instead of /etc/default. Changing that fixed the issue - thank you Nathan and Kindule – ali haider Dec 10 '13 at 22:45
up vote 6 down vote accepted

Your should use

sh -x /etc/init.d/haproxy start

and this will print debug infomation.And where you got wrong.

share|improve this answer
I tried it earlier as well but did not pay enough attention to it - a closer look helped me realize the enabled flag was not setup in the correct place. I fixed it - accepting your answer – ali haider Dec 10 '13 at 22:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.