The solution to the problem that CentOS cannot access Tomcat after opening it: first open the firewall, the code is [systemctl start firewalld]; then execute the command to open the 8080 port, and then restart the firewall; finally verify that the opened 8080 port takes effect. Can.
Solution to the inability to access CentOS after opening Tomcat:
First check whether the firewall is started:
firewall-cmd --state
If "running" appears, the firewall is running. If there is no prompt, enter the command to open the firewall:
systemctl start firewalld
Then enter the command to check whether port 8080 is opened by the firewall (if "8080/tcp" appears "Indicates that the port is opened):
firewall-cmd --permanent --zone=public --list-ports
If nothing is prompted, it means that port 8080 is not opened; you need to execute the command to open port 8080 (if "success" appears, it means the addition was successful):
firewall-cmd --zone=public --add-port=8080/tcp --permanent
Restart the firewall:
firewall-cmd --reload
Finally, verify whether the opened 8080 port is effective (you can also directly access tomcat through the browser to test):
firewall-cmd --zone=public --query-port=8080/tcp
If "yes" appears , indicating that the opening is successful, so that you can access tomcat normally!
Recommended related tutorials: centos tutorial
The above is the detailed content of What should I do if I cannot access Tomcat after opening it on CentOS?. For more information, please follow other related articles on the PHP Chinese website!