Now if you need to control ports so you can run several apps on different ports, you got to keep in mind that listening to this port from your VHost isn’t enough. You should open that port from the firewall. Firewall software that is included in CentOS7 is firewalld, and here we got the main commands to get the job done.
sudo systemctl status firewalld
sudo systemctl start firewalld
To list all configuration already running:
sudo firewall-cmd --list-all
sudo firewall-cmd --list-ports
sudo firewall-cmd --list-services
sudo firewall-cmd --zone=public --add-port=81/tcp --permanent
sudo firewall-cmd --reload
Without “–permanent” flag, port 81 will be closed agian on reboot.
Similarly we can reverse the last one this way:
firewall-cmd --remove-port=81/tcp --permanent