CentoS open ports in Tomcat

1. After installing tomcat found, found it impossible to access the tomcat home, later found no open firewall port 8080.

Note that: CentOS 7 firewall switch to Friewalld, so use the following command will add the port number Firewall:

firewall-cmd --zone=public --add-port=8080/tcp --permanent

firewall-cmd --reload

Command Meaning:
    -zone # scope
    -add-port = 80 / tcp # Add port, the format is: port / protocol
    -permanent # permanent, this parameter does not restart after failure

Finally, remember to reload the emergence success is to set success. When I execute the command, an error occurs firewalld is not running, the following command will firewalld can play together, and allowed to self-starting

Restart: #systemctl restart firewalld.service 
start: # systemctl start firewalld 
view the status: # systemctl status firewalld or firewall-cmd --state 
boot is started: # systemctl disable | enable firewalld 
disabled: # systemctl stop firewalld 
updated firewall rules: 
# Firewall --reload -cmd 
# --complete Firewall-cmd-reload

The first is the difference between the two without having to disconnect the connection is dynamically adding one rule firewalld characteristics, need to disconnect a second, similar to restart the service

View all open ports

firewall-cmd --zone=public --list-ports

Open port before Centos7

Open port 80: # iptables -I INPUT -p tcp --dport 80 -j ACCEPT 
view the status of the firewall: # service iptables status 
is saved to the firewall rules: #service iptables save 
to restart the firewall: #service iptables restart

/etc/firewalld/zones/public.xml // routing file

Guess you like

Origin www.cnblogs.com/loveyoul9/p/11607181.html