linux solution after the start tomcat browser inaccessible

linux solution after the start tomcat browser inaccessible

http://www.jb51.net/article/130218.htm

Foreword

Whether you want to start, or to shut down tomcat service, are going to install tomcat bin directory path, of course, if your computer shuts down naturally is not required.

But recently after starting discovered a problem: Centos servers, local and server ip ping each normal (native ping server, ping local), but later deployed tomcat server, the machine can not tomcat through a browser to access the server 8080 port.

For example, the public network server ip is: 123.123.123.123, after starting tomcat default port is 8080, when accessed through 123.123.123.123:8080, tomcat can not access the default page issue to consider is the server firewall.

Confirm turned tomcat

$ Ps -ef | grep tomcat
console output, indicating that already is on tomcat

root 1428 1 0 Dec08? 00:02:16 /usr/local/java/jdk1.8.0_152/jre/bin/java -Djava.util.logging.config.file = / usr / local / java / tomcat8 / conf / logging.properties -Djava.util.logging.manager = org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize = 2048 -Djava.protocol.handler.pkgs = org.apache.catalina.webresources -classpath / usr / local / java / tomcat8 / bin / bootstrap.jar: /usr/local/java/tomcat8/bin/tomcat-juli.jar -Dcatalina.base = / usr / local / java / tomcat8 -Dcatalina.home = / usr / local / java / tomcat8 -Djava.io.tmpdir = / usr / local / Java / tomcat8 / TEMP org.apache.catalina.startup.Bootstrap Start
the root PTS 09:16 4932 4069 0/0 = Auto --color 00:00:00 grep tomcat
If tomcat is not on, by the tomcat turned startup.sh command, direct input path to the file.

$ /Usr/local/java/tomcat8/bin/startup.sh
console output:

[root@izbp109iqt20o2h63tpcuvz ~]# /usr/local/java/tomcat8/bin/startup.sh
Using CATALINA_BASE: /usr/local/java/tomcat8
Using CATALINA_HOME: /usr/local/java/tomcat8
Using CATALINA_TMPDIR: /usr/local/java/tomcat8/temp
Using JRE_HOME: /usr/local/java/jdk1.8.0_152/jre
Using CLASSPATH: /usr/local/java/tomcat8/bin/bootstrap.jar:/usr/local/java/tomcat8/bin/tomcat-juli.jar
Tomcat started.
Tomcat started.表明tomcat已开启成功!

Configure the firewall

Edit Firewall Configuration

$ Vi / etc / sysconfig / iptables
add firewall port 8080, allowing access.

filter *
: the INPUT ACCEPT [0: 0]
: the FORWARD ACCEPT [0: 0]
: the OUTPUT ACCEPT [0: 0]
-A the INPUT -m --state The RELATED State, the ESTABLISHED -j ACCEPT
-A the INPUT -p ICMP -j ACCEPT
the INPUT LO -i -j ACCEPT -A
-A State --state the INPUT NEW -p -m -m TCP TCP 22 is --dport -j ACCEPT
-A State --state the INPUT NEW -m -m -p TCP TCP - 80 -j ACCEPT dport
-A State --state the INPUT NEW -m -m -p TCP TCP --dport 3306 -j ACCEPT
-A State --state the INPUT NEW -m -m -p TCP TCP --dport 8080 -j ACCEPT
-A with the INPUT -j REJECT --reject-ICMP-Host-Prohibited
-A with the FORWARD -j REJECT --reject-ICMP-Host-Prohibited
! Note critical: a port must be above the following configuration, put invalid below.

The INPUT -j REJECT --reject--A with ICMP-Host-Prohibited
-A with the FORWARD -j REJECT --reject-ICMP-Host-Prohibited
input i start editing, ESC key to end the edit, WQ save and exit.

Restart the firewall

$ Service iptables restart
after 123.123.123.123:8080 can be accessed through a browser in the machine, you can normally see the default tomcat welcome page.

Guess you like

Origin blog.csdn.net/wcc178399/article/details/91042780