Cause analysis:
Tomcat access requires port 8080, but when accessed from the outside, our firewall will intercept it, and you happen to not configure port 8080 at this time. Firewall is not turned off.
Solution:
1. First enter the following command to open the firewall configuration file
vi /etc/sysconfig/iptables
(Recommended tutorial: centos tutorial)
2. Find -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT, we copy this sentence to the next line
3 , change the copied content to the following
-A INPUT -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT
(that is, change 22 to the port you want to open, for example: we open 8080)
4. Press the esc key to enter :wq! Save and exit
5. Restart the firewall
The command is as follows:
service iptables restart
Recommended related video tutorials:linux video tutorial
The above is the detailed content of Tomcat cannot be accessed remotely under centos. For more information, please follow other related articles on the PHP Chinese website!