Add port 80 to firewalld CentOS 7

By default the port 80 for http connection is filtered on Redhat 7 as you can only access this port from the actual localhost and not from any other public host. To open a port 80 on RHEL 7 Linux we need to add an iptables rule. For this RHEL7 uses firewall-cmd. First add your port 80 rule with a following command:

# firewall-cmd --permanent --zone=public --add-port=80/tcp --permanent

Once you add the above firewall rule reload firewall service:

# firewall-cmd --reload

# firewall-cmd --permanent --zone=<zone> --add-service=http

# firewall-cmd --permanent --zone=<zone> --add-port=80/tcp

You can check if the port has actually be opened by running:

# firewall-cmd --zone=<zone> --query-port=80/tcp

# firewall-cmd --zone=<zone> --query-service=http