Home  >  Article  >  Operation and Maintenance  >  Tomcat cannot be accessed under linux

Tomcat cannot be accessed under linux

王林
王林Original
2020-01-11 15:06:343743browse

Tomcat cannot be accessed under linux

Question:

Install centOS7 on the virtual machine, configure Tomcat and start it successfully. But Tomcat port 8080 cannot be accessed in the browser.

Reason:

Because in CentOS 7 or RHEL 7 or Fedora, the default firewall is managed by firewalld, and firewalld does not open port 8080, so port 8080 is opened. configuration.

In versions before CentOs 7, iptables controls Linuxs ports.

After upgrading CentOS to 7, you cannot use iptables to control Linuxs ports because Centos 7 uses firewalld instead of the original iptables.

(Free online video tutorial sharing: linux video tutorial)

Solution:

1. Open 8080 port on firewalld

The command is as follows:

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

Command analysis:

--zone #作用域
--add-port=8080/tcp #添加端口,格式为:端口/通讯协议
--permanent #永久生效,没有此参数设置,重启后会失效

2. Restart the firewall

The command is as follows:

firewall-cmd --reload

Tomcat cannot be accessed under linux

3. Open an external browser and enter http://centOS IP:8080 to see the Tomcat welcome interface!

Tomcat cannot be accessed under linux

Recommended related articles and tutorials: linux tutorial

The above is the detailed content of Tomcat cannot be accessed under linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn