In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
2025-12-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
1. Install JDK
(permanent address of this article: http://woymk.blog.51cto.com/10000269/1922036)
JDK official website address:
Http://www.oracle.com/technetwork/java/javase/downloads/index.html
Click "JDK DOWNLOAD" to enter the download page
To download the JDK package, please check "Accept License Agreement" to download it.
Here we download the jdk-8u131-linux-x64.tar.gz package.
Copy the downloaded package to the / usr/local/src directory
Decompress after download:
Tar zxvf jdk-8u131-linux-x64.tar.gz
Mv jdk1.8.0_131 / usr/local/jdk1.8.0_131
Vi / etc/profile.d/java.sh
Add the following configuration
JAVA_HOME=/usr/local/jdk1.8.0_131
JAVA_BIN=/usr/local/jdk1.8.0_131/bin
JRE_HOME=/usr/local/jdk1.8.0_131/jre
PATH=$PATH:/usr/local/jdk1.8.0_131/bin:/usr/local/jdk1.8.0_131/jre/bin
CLASSPATH=/usr/local/jdk1.8.0_131/jre/lib:/usr/local/jdk1.8.0_131/lib:/usr/local/jdk1.8.0_131/jre/lib/charsets.jar
Execute after saving
. / etc/profile.d/java.sh
If the above configuration is successful, the following command can see the version of java:
Java-version
[root@www src] # java-version
Java version "1.8.0,131"
Java (TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot (TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
two。 Install tomcat
The latest software package can be downloaded from Tomcat's website http://tomcat.apache.org.
Cd / usr/local/src/
Wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-8/v8.5.14/bin/apache-tomcat-
8.5.14.tar.gz
Tar zxvf apache-tomcat-8.5.14.tar.gz
Mv apache-tomcat-8.5.14 / usr/local/tomcat
Cp-pv / usr/local/tomcat/bin/catalina.sh / etc/init.d/tomcat
Vi / etc/init.d/tomcat
Join from the second line
# chkconfig: 2345 63 37
# description: tomcat server init script
# Source Function Library
. / etc/init.d/functions
JAVA_HOME=/usr/local/jdk1.8.0_131
CATALINA_HOME=/usr/local/tomcat
Execute after saving:
Chmod 755 / etc/init.d/tomcat
Chkconfig-add tomcat
Chkconfig tomcat on
Service tomcat start
View tomcat processes
Ps aux | grep tomcat
test
Enter http://ip:8080 in the browser and you can see the welcome page of tomcat
3. Configure tomcat
Cd / usr/local/tomcat
Vi conf/server.xml
Change the default startup port:
find
Connector port= "8080"
You can change it to the port number you need, such as
Connector port= "80"
Add a virtual host:
Find the next line and insert the new content as follows:
Restart tomcat after saving
Service tomcat stop & & service tomcat start
Test:
Vi / data/tomcatweb/1.jsp
Add the following
Now time is:
Execute after saving
Curl-x127.0.0.1 80 www.test.com/1.jsp
[root@www tomcat] # curl-x127.0.0.1 www.test.com/1.jsp
Now time is: Sat Apr 29 11:46:21 CST 2017
4. Tomcat combined with Nginx
For nginx installation, please refer to: LNMP Environment Building (centos6.9+mysql5.7+php7.1+nginx1.10)
Vi / usr/local/nginx/conf/nginx.conf
find
Root html
Index index.html index.htm
Change to
Root / data/tomcatweb
Index index.html index.htm index.jsp
Add the following paragraph:
Location ~\ .jsp$ {
Proxy_pass http://127.0.0.1:8080;
}
Restart nginx after modification
Service nginx restart
Note that the port numbers of tomcat and nginx are 8080 and 80, respectively. Do not conflict with each other.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.