Get the App
SLTechnology News&Howtos  ›  Network Security  › 

Tomcat configuration

Shulou Source: shulou.com Published: 2022-06-01 02:42:49 10月04日 Update

Tomcat configuration

Jdk and tomcat do not need to be compiled.

Tomcat does not support restart

jdk official website www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html

Java programs cannot be compiled without jdk

tomcat official website tomcat.apache.org/

jdk in other words java, equivalent to php in lamp

Tomcat is apache.

1. install the JDK

cd /usr/local/src

wget'http://download.oracle.com/otn-pub/java/jdk/8u91-b14/jdk-8u91-linux-i586.tar.gz? AuthParam=1466748694_4fba144996aad848aa5ee7344c94ad2e'

tar -zxvf jdk-8u77-linux-i586. gz//file names may vary

mv jdk1.8.0_77 /usr/local/

vim /etc/profile.d/java.sh

Add content:

JAVA_HOME=/usr/local/jdk1.8.0_77

JAVA_BIN=/usr/local/jdk1.8.0_77/bin

JRE_HOME=/usr/local/jdk1.8.0_77/jre

CLASSPATH=/usr/local/jdk1.8.0_77/jre/lib:/usr/local/jdk1.8.0_77/lib:/usr/local/jdk1.8.0_77/jre/lib/charsets.jar

PATH=/usr/local/jdk1.8.0_77/bin:/usr/local/jdk1.8.0_77/jre/bin:$PATH

//Put $PATH at the end of the line to ensure that the first java found is installed by yourself

source /etc/profile.d/java.sh

java -version

//display your own installed version is OK

2. Install tomcat

cd /usr/local/src

wget'http://apache.fayea.com/tomcat/tomcat-7/v7.0.70/bin/apache-tomcat-7.0.70.tar.gz'

tar -zxvf apache-tomcat-7.0.70.tar.gz

mv apache-tomcat-7.0.70 /usr/local/tomcat

cp /usr/local/tomcat/bin/catalina.sh.d/tomcat /copy startup script

vim /etc/init.d/tomcat

Add content:

#chkconfig: 2345 63 37

. /etc/init.d/functions

JAVA_HOME=/usr/local/jdk1.8.0_91

CATALINA_HOME=/usr/local/tomcat

chkconfig --add tomcat

chkconfig tomcat on

/etc/init.d/tomcat start

Enter 192.168.134.137:8080 in the browser to see the tomcat welcome page

Tomcat configuration

vim /usr/local/tomcat/conf/server.xml

8080 modified 80 //tomcat indicates comment

Add Virtual Host

//immediately above, where docBase="./ "is relative to appBase="/data/tomcatweb"

The requested URL/data/tomcatweb /tomcat was not found on this server.

/etc/init.d/tomcat stop

The requested URL/etc/init.d/tomcat/was not found on this server.

vim /data/tomcatweb/1.jsp

Add content:

Now time is:

curl -xlocalhost:80 www.111.com/1.jsp

display

Now time is: Sat Jun 25 21:25:18 CST 2016

//indicates tomcat configuration successfully

Tags: Configuration content compilation success host name that is copy file end comment browser version directory program port script virtual host facet page Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL macOS Shulou Tech Info Xiaomi Linux