In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "the installation and optimization method of Tomcat under the linux platform". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the installation and optimization method of Tomcat under the linux platform".
Tomcat server is a free and open source Web application server, which is a lightweight application server. It is widely used in small and medium-sized systems and not many concurrent access users. It is the first choice for developing and debugging JSP programs. For a beginner, it can be thought that when an Apache server is configured on a machine, it can be used to respond to requests for access to HTML (an application under the standard general markup language) pages. Tomcat is actually an extension of the Apache server, but at run time it runs independently, so when you run tomcat, it actually runs as a separate process from Apache.
I. introduction to Tomcat
Tomcat server is a free and open source Web application server, which is a lightweight application server. It is widely used in small and medium-sized systems and not many concurrent access users. It is the first choice for developing and debugging JSP programs. For a beginner, it can be thought that when an Apache server is configured on a machine
Server, which can be used to respond to requests for access to HTML (an application under the standard general markup language) page. Tomcat is actually an extension of the Apache server, but at run time it runs independently, so when you run tomcat, it actually runs as a separate process from Apache.
The trick is that when configured correctly, Apache serves the HTML page, while Tomcat actually runs the JSP page and Servlet. In addition, like Web servers such as IIS, Tomcat has the function of dealing with HTML pages, and it is also a Servlet and JSP container, and a separate Servlet container is the default mode of Tomcat. But,
Tomcat is not as capable of handling static HTML as Apache servers.
II. Tomcat installation
Prepare before installation:
Before installing Tomcat, you must install JDK,JDK, whose full name is Java Development Kit, which is a free java language software development kit provided by SUN, which includes the Java virtual machine (JVM). The written java source program can be compiled to produce java bytecode. As long as JDK is installed, you can use JVM to explain these.
Bytecode files, thus ensuring the cross-platform nature of Java.
In terms of platform compatibility, JDK, as a java virtual machine that interprets the bytecode file and calls the API of the operating system to achieve the corresponding function, is closely related to the number of bits of the operating system, so there are different types of versions, and Tomcat also has the above characteristics, so you need to download JDK and Tomcat in advance.
JDK download address: http://www.oracle.com/technetwork/java/javase/downloads/
Tomcat download address: http://tomcat.apache.org
1. Uninstall openjdk that comes with the system and install jdk
[root@tomcat1 ~] # rm-rf $(which java) [root@tomcat1 ~] # tar xf jdk-7u80-linux-x64.tar [root@tomcat1 ~] # mv jdk1.7.0_80/ / usr/local/java
two。 Extract and install Tomcat
[root@tomcat1 ~] # tar xf apache-tomcat-8.5.20.tar.gz [root@tomcat1 ~] # mv apache-tomcat-8.5.20 / usr/local/tomcat8
3. Set the JAVA environment variable
[root@tomcat1 ~] # vim / etc/profile.d/java.shexport JAVA_HOME= "/ usr/local/java" # # set the java root directory export PATH=$PATH:$JAVA_HOME/bin:/usr/local/tomcat8/bin # add java to the PATH environment variable and the bin subdirectory of the directory [root@tomcat1 ~] #. / etc/profile # Import the java.sh script into the environment variable to make it effective
4. Run the java-version or javac-version command to view the java version
[root@tomcat1] # java-versionjava version "1.7.0y65" Java (TM) SE Runtime Environment (build 1.7.0_65-b17) Java HotSpot (TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
5. Start Tomcat
[root@tomcat1 ~] # / usr/local/tomcat7/bin/startup.shUsing CATALINA_BASE: / usr/local/tomcat7Using CATALINA_HOME: / usr/local/tomcat7Using CATALINA_TMPDIR: / usr/local/tomcat7/tempUsing JRE_HOME: / usr/local/javaUsing CLASSPATH: / usr/local/tomcat7/bin/bootstrap.jar:/usr/local/tomcat7/bin/tomcat-juli.jarTomcat started.Tomcat runs on port 8080 [root@tomcat1 ~] # netstat-anpt by default | grep: 8080tcp 0: 8080: * LISTEN 3318/java
6. Close Tomcat
[root@tomcat1 ~] # / usr/local/tomcat7/bin/shutdown.sh browser access test http://IP: port
7. Modify port number
[root@tomcat1 ~] # vim / usr/local/tomcat8/conf/server.xml modified port: 8080-95288005-95298009-9530 [root@tomcat1 ~] # / usr/local/tomcat8/bin/startup.sh [root@tomcat1 ~] # netstat-anpt | grep javatcp 00 0.0.0.0usr/local/tomcat8/conf/server.xml 9528 0.0.0.0usr/local/tomcat8/conf/server.xml * LISTEN 5625/javatcp 00 127.0.0.1usr/local/tomcat8/conf/server.xml 9529 0.0.0.0 .0VR 9530 0.0.0.0 LISTEN 5625/java Note: turn off the firewall and selinux security mechanism If it is an Ali CVM, the console security group needs to release port 8080 of the TCP protocol. Systemctl disable firewalld permanently shuts down firewall systemctl stop firewalld temporarily shuts down firewall setenforce 0 shuts down Selinux
Instructions for 8.Tomcat configuration
/ usr/local/tomcat home directory (installation directory) bin script files for Tomcat started or shut down on windows or linux platforms conf stores various global configuration files of Tomcat The most important of these is that server.xml and web.xmllib store library files (JARS) needed for Tomcat operation. Logs stores LOG files for Tomcat execution. The main Web distribution directory (including application cases) htdocs (html php) work stores class files generated by jsp compilation [root@tomcat1 ~] # ls / usr/local/tomcat/conf/catalina.policy access control configuration file catalina.properties Tomcat properties configuration file context.xml up and down Text configuration file (selinux) logging.properties log log related configuration file server.xml main configuration file tomcat-users.xml manager-gui management user profile (administrative interface generated after Tomcat installation This file can be opened and accessed) web.xml Tomcat servlet,servlet-mapping,filter,MIME and other related configuration server.xml main configuration files, you can modify the startup port, set the website root directory, virtual host, enable https and other functions.
III. Tomcat optimization
1. Disable AJP protocol for tomcat
[root@tomcat1 conf] # vim server.xml Note:
two。 Modify communication mode BIO to NIO to improve concurrent processing capability
# remove comments # remove comments and modify protocol:
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.