Solve the problem that tomcat in Linux starts successfully but cannot be accessed locally!

Step1. Start tomcat

   进入 tomcat 所在的目录的 bin 的文件夹下执行" ./ startup.sh" 命令 启动 tomcat ,如果出现下面这种情况说明 tomcat 启动 成功。

Step2. Verify whether tomcat starts successfully

输入" ps -ef|grep tomcat " 命令验证 tomcat 是否启动成功,如果出现下面这种情况说明启动成功。

Step3: If the startup is successful, enter curl http://192.168.112.130:8080 (your own Linux IP) in Linux to see if access is normal.

The following indicates normal access:

Step4. Check whether the firewall is enabled

   输入命令 "  firewall-cmd --state " 如果出现如图所示的这种情况说明正在运行,如果没有正在运行需要执行命令" systemctl start firewalld "开启防火墙服务

Step5. Check whether port 8080 is opened by the firewall

   输入命令" firewall-cmd --permanent --zone=public --list-ports “  如果终端输出 “8080/tcp” 则说明8080端口被开启

If there is no such output, you need to execute the command "firewall-cmd --zone=public --add-port=8080/tcp --permanent" to open port 8080. If "success" appears, it means the addition is successful.

Step6. Restart the firewall

输入命令" firewall-cmd --reload" 重新启动防火墙,出现” success“ 字样则表示重新启动成功。

Step7. Verify whether the opened 8080 port is effective

 输入命令” firewall-cmd --zone=public --query-port=8080/tcp“ 验证8080端口是否生效,如果出现 ” yes “字样则代表生效。

At this point, restart tomcat and you can use an external browser to access tomcat in centos.

Guess you like

Origin blog.csdn.net/qq_41787812/article/details/133191127