M
M
mr_blond972015-09-09 21:36:43
Amazon Web Services
mr_blond97, 2015-09-09 21:36:43

Why is haproxy not working?

Created two ubuntu instances on amazon.com. On both I tried to configure haproxy. Haproxy works on one instance, did not touch apitables on it. On the other, after an unsuccessful setup, iptables stopped working curl localhost, issues 503 Service Unavailable No server is available to handle this request. Tried rebooting the instance, didn't help. Help me figure out what could be wrong.
Here's what I did with apitables:

iptables -A INPUT -i $WAN -p tcp --dport 80 -j ACCEPT
    iptables -A INPUT -p icmp --dport 80 -j ACCEPT
    iptables -A INPUT -p icmp -m state --state ESTABLISHED,RELATED -j ACCEPT
    iptables -A ufw-before-input -p icmp --icmp-type echo-request -j ACCEPT
iptables -A INPUT -s ... -p icmp --icmp-type echo-request -j ACCEPT
iptables -A INPUT -m state --state NEW -p tcp --dport 80 -j ACCEPT

Haproxy config:
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
user haproxy
group haproxy
daemon
defaults
log global
mode http
option httplog
option dontlognull
contimeout 5000
clitimeout 50000
srvtimeout 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 tutorial_im
bind *:80
default_backend tutorial_http
backend tutorial_http
balance roundrobin
mode http
server web1 *.*.*.*:80 check

iptables -L -nv output:
Chain INPUT (policy ACCEPT 2749 packets, 232K bytes)
pkts bytes target prot opt ​​in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt ​​in out source destination
Chain OUTPUT (policy ACCEPT 5704 packets, 675K bytes )
pkts bytes target prot opt ​​in out source destination

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
mr_blond97, 2015-09-10
@mr_blond97

Found the reason. Amazone EC2 has its own firewall that blocks all connections by default.

A
Andrey Nikiforov, 2015-09-09
@eoffsock

Well, drop iptables and try again carefully one by one.
When you find a problematic rule, smoke manuals.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question