i'm trying to use HAProxy to redirect on different nodejs webserver working on three different port. What i want is that when i try to open /node1 HAProxy redirect me to that web server. This is HAProxy configuration:
frontend dispatcher
mode http
bind *:80
acl node_serv1 url_beg /node1
acl node_serv2 url_beg /node2
acl node_serv3 url_beg /node3
use_backend backend_1 if node_serv1
use_backend backend_2 if node_serv2
use_backend backend_3 if node_serv3
backend backend_1
mode http
balance roundrobin
option httpchk
server web01 127.0.0.1:3001 check
backend backend_2
mode http
balance roundrobin
option httpchk
server web02 127.0.0.1:3002 check
backend backend_3
mode http
balance roundrobin
option httpchk
server web03 127.0.0.1:3003 check
All three nodejs webserver are working but when i try to start haproxy i get this error:
Starting haproxy: [ALERT] 111/105652 (27208) : Starting frontend dispatcher: cannot bind socket [0.0.0.0:80]
looking on web someone suggest to add this property
net.ipv4.ip_nonlocal_bind=1
on /etc/sysctl.conf
but the error persists and HAProxy doesn't start. What's wrong in my configuration?
netstat -anp | grep ":80"
? Besides: Do you know what settingnet.ipv4.ip_nonlocal_bind
to1
does? (I doubt it's needed in your environment..)