0
votes

Let Me describe the scenrio:

I have two servers , i.e server1 and server2 and running apache on both . I have installed haproxy on server1 and configured like : global log /dev/log local0 log /dev/log local1 notice chroot /var/lib/haproxy stats socket /run/haproxy/admin.sock mode 660 level admin stats timeout 30s user haproxy group haproxy daemon defaults log global mode http option httplog option dontlognull timeout connect 5000 timeout client 50000 timeout server 50000 errorfile 400 /etc/haproxy/errors/400.http errorfile 403 /etc/haproxy/errors/403.http errorfile 408 /etc/haproxy/errors/408.http errorfile 500 /etc/haproxy/errors/500.http errorfile 502 /etc/haproxy/errors/502.http errorfile 503 /etc/haproxy/errors/503.http errorfile 504 /etc/haproxy/errors/504.http frontend localnodes bind *:80 mode http default_backend nodes backend nodes mode http balance roundrobin option forwardfor option httpchk HEAD / HTTP/1.1\r\nHost:localhost server web01 IP1:80 check server web02 IP2:80 check listen stats *:1936 stats enable stats uri / stats hide-version stats auth username:password

While running haproxy (service haproxy restart) , I am getting following error:

Starting frontend localnodes: cannot bind socket

I tried to change the apache default port to 81 to , also I tried to change sysctl.conf , net.ipv4.ip_nonlocal_bind=1 ... Still getting same error . I am very new to server configuration , can any one help ?

1
Ports above 1023 do work? I guess you start it manually? If that is the case, set up a proper initscript/unit-file. - sjas

1 Answers

0
votes

If ports are free (check with netstat -punta | grep 80) start the service with user root. Change "user haproxy" and "group haproxy" to "user root" and "group root"