FirewallD |CentOS 7 [SOLVED]
I would like know which the best practice for add port web to FirewallD in CentOS 7.
When you add Apache/HTTPD
Way 1:
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
Way 2:
sudo firewall-cmd --permanent --zone=public --add-port=80/tcp
sudo firewall-cmd --permanent --zone=public --add-port=443/tcp
2 Replies
mjones
Linode Staff
Both methods are functionally equivalent, as add-service simply adds the default port for the service. Whichever one you'd prefer is the one I'd recommend using. In most cases, using add-service is suggested for readability and ease of use, but if you ever need to use a non-standard port for a service you'll nee to use add-port instead.