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/02 Report--
I. the origin of tomcat
The origin of the name: tomcat was originally developed by James Duncan Davidson, a software architect at Sun. He later helped turn it into an open source project, which Sun contributed to the Apache Software Foundation. Since most open source projects, O'Reilly, publish a related book and design its cover as a sketch of an animal, he wants to name the project after an animal. Because he wanted the animal to take care of itself, he eventually named it tomcat (male cat).
1. Tomcat application scenarios
Tomcat server is a free 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 users. It is the first choice for developing and testing JSP programs. Generally speaking, although Tomcat is the same as apache or Nginx web servers, it has the function of dealing with HTML pages, but its ability to deal with static pages is far less than apache or Nginx, so Tomcat generally runs on the back end as a servlet and JSP container.
2. Dependent software required by Tomcat
Before installing Tomcat, you must install JDK,JDK, 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 form Java bytecode. As long as you install JDK, you can use JVM to interpret these code files, thus ensuring the cross-platform nature of Java.
In terms of platform compatibility, JDK, as a Java virtual machine that interprets bytecode files and calls the API of the operating system to achieve the corresponding functions, is closely related to the type of operating system and the number of platform digits, so there are different types of versions, and Tomcat also has these characteristics. (JDK has been installed by default in Centos 7.0. if it is a Centos 6.0operating system, it needs to be installed by itself).
1) check whether JDK is installed
[root@centos02 ~] # java-versionopenjdk version "1.8.0mm 131" OpenJDK Runtime Environment (build 1.8.0_131-b12) OpenJDK 64-Bit Server VM (build 25.131-b12, mixed mode)
2) Centos 6.0installs JDK
[root@centos02 ~] # mount / dev/cdrom / mnt/ mount: / dev/sr0 write protection [root@centos02 ~] # tar zxvf / mnt/jdk-7u65-linux-x64.gz-C / usr/src/ [root@centos02 src] # lsdebug jdk1.7.0_65 kernels [root@centos02 src] # mv jdk1.7.0_65/ / usr/src/java [root@centos02 ~] # vim / etc/profile.d/java.shexport JAVA_HOME=/usr/local/javaexport PATH=$PATH:$JAVA_HOME/ [root @ centos02 ~] # chmod + x will be mounted read-only / etc/profile.d/java.sh [root@centos02 ~] # source / etc/profile.d/java.sh II. Instructions related to the configuration of Tomcat 1. The main directory of Tomcat
The main directory of tomcat is / usr/local/tomcat8/.
[root@centos02] # cd / usr/local/tomcat/ [root@centos02 tomcat] # ll Total amount 96drwxr-xr-x 2 root root 4096 November 30 19:48 bindrwxr-xr-x 3 root root 1747 November 30 20:03 confdrwxr-xr-x 2 root root 4096 November 30 19:48 lib-rw-r--r-- 1 root root 56812 May 20 2014 LICENSEdrwxr-xr-x 2 root root 197 November 30 19:51 logs-rw-r--r-- 1 root root 1192 May 20 2014 NOTICE-rw-r--r-- 1 root root 8974 May 20 2014 RELEASE-NOTES-rw-r--r-- 1 root root 16204 May 20 2014 RUNNING.txtdrwxr-xr-x 2 root root 30 November 30 19:48 tempdrwxr-xr-x 7 root root 81 May 20 2014 webappsdrwxr-xr-x 3 root root 22 November 30 19:51 work
The main catalogs are as follows:
| |-bin/: stores script files for starting and closing Tomcat on Windows or Linux platforms |
| |-conf/: stores various global configuration files of Tomcat server, the most important of which are server.xml and web.xml |
| |-lib/: stores library files needed for Tomcat to run |
| |-logs/: stores LOG files when Tomcat executes |
| |-webapps:Tomcat 's main web publishing directory (including application examples) |
| |-work: stores the class file generated by JSP compilation |
2 、 Configuration file states [root@centos02 tomcat] # ll conf/ Total usage 200drwxr-xr-x 3 root root 23 November 30 19:51 Catalina-rw- 1 root root 12257 May 20 2014 catalina.policy-rw- 1 root root 6294 May 20 2014 catalina.properties-rw- 1 root root 1394 May 20 2014 context.xml-rw- 1 root root 3288 May 20 2014 logging.properties-rw -1 root root 6610 November 30 20:03 server.xml-rw- 1 root root 1530 May 20 2014 tomcat-users.xml-rw- 1 root root 163385 May 20 2014 web.xml
The profile is described as follows:
Catalina.policy: permission control profil
Catalina.properties:Tomcat property profile
Context.xml: context profile
Logging.properties: log log related configuration fil
Server.xml: main profile
Tomcat-users.xml:manager-gui management user profile (Tomcatt installation provides a manager-gui management interface, which can be accessed by configuring the file)
Servlet, servlet-mapping, filter, MIME and other related configurations of web.xml:Tomcat
3. Tomcat main configuration file description
Server.xml is the main configuration file of Tomcat. By configuring this file, you can modify the startup port of Tomcat, website directory, virtual host, open https and other important functions.
The whole server.xml consists of the following structures:, and.
The following is part of the default installation of the server.xml file, which contains annotated information. The / / sign begins with a self-made comment:
[root@Centos01 tomcat8] # vim conf/server.xml. / / some contents are omitted / / Tomcat closes the port. By default, it is only available for local addresses. It can be accessed locally through Telnet 127.0.0.1 8005. / / A pair of Tomcat is closed. / / part of the content is omitted here / / the default port number for Tomcat startup is 8080, which can be changed as needed. . / / some of the contents are omitted here / / the default port number when Tomcat starts the AJP 1.3 connector, which can be changed as needed. / / some of the contents are omitted here / / the following configuration and log configuration when defining virtual hosts for Tomcat
4. Description of the components of Tomcat server
1) Server
The server element represents the servlet container for the entire CatAlina.
2) Service
A Service is a collection of one or more Connector and an Engine (responsible for processing all customer requests obtained by Connector).
3) Connector
A Connector listens for customer requests on a specified port and passes the obtained requests to the Engine for processing, gets a response from the Engine and returns to the customer.
Tomcat has two typical Connector, one listening directly for http requests from browser, and one listening for requests from other webserver.
Coyote HTTP/1.1 Connector listens for http requests from the customer browser (browsing) at port 8080.
Coyote JK2 Connector listens for servlet/jsp proxy requests from other text server (Apache) at port 8009.
4) Engine
Multiple virtual hosts virtual host can be configured under Engine, each with a domain name.
When Engine gets a request, it matches the request to a Host and then passes the request to the host for processing.
Engine has a default virtual host that will be handed over to the default host when the request cannot be matched to any host.
5) Host
Host represents a virtual Host, or virtual host, where each virtual host matches a network domain name, Domain Name.
One or more web app can be deployed under each virtual host, with each web app corresponding to a Context and a Context path.
When host gets a request, it matches the request to a Context and then passes the request to the Context for processing. The matching method is "longest match", so a Context of path== "" will become the default Context for that Host.
All requests that cannot match the pathnames of other Context will eventually match that default Context.
6) Context
A Context corresponds to a web application, and a web application consists of one or more servlet.
Summary
The above is the Tomcat server of the Centos 7 system introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply you in time. Thank you very much for your support to the website!
If you think this article is helpful to you, you are welcome to reprint it, please indicate the source, thank you!
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.