I've CentOS 7 server without firewalld but with iptables installed.
There's WildFly 10 is running with changed socket binding http port 8080
to 80
in standalone.xml
.
I'd open 80 port in iptables with these commands:
# iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
# iptables -A OUTPUT -p tcp -m tcp --dport 80 -j ACCEPT
but the server is still unreachable until I stop iptables.
How to fix it?
Update:
#iptables -S
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A INPUT -p tcp -m tcp --sport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --sport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --sport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --sport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --sport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 8080 -j ACCEPT
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
-A OUTPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 8080 -j ACCEPT
# netstat -nltp | grep :80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 10042/java
--dport
(destination port) open for INPUT. So that requests from outside are allowed.Try like this:iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
iptables -S
andnetstat -nltp | grep :80
-A INPUT -j REJECT --reject-with icmp-host-prohibited
where everything is rejected afterwards. So remove it first and add it add the end. The orders of the rules are incorrect. put the reject rules at the end and remove the duplicate rules, flush iptables.