In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail the example analysis of the configuration file server.xml in tomcat7. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
Here is an explanation of tomcat7's server.xml file to make it easier to understand what Digester does when analyzing the startup source code.
Server
Server in tomcat represents an instance of tomcat, so only one Server exists, and it also appears as a top-level element in the configuration file, as shown in the following code:
. . .
Port, the port that listens for the shutdown command, and-1 means that the shutdown command is disabled.
Shutdown, the instruction to turn off tomcat.
Listener
A listener used to listen for the occurrence of certain events.
The copy code is as follows:
VersionLoggerListener, print logs to tomcat,java and operating system information at startup.
The copy code is as follows:
SecurityListener, do some security checks when you start tomcat.
The copy code is as follows:
AprLifecycleListener, which is used to listen for Apache server related.
The copy code is as follows:
JasperListener,Jasper 2 JSP engine, which is mainly responsible for recompiling the updated jsp.
The copy code is as follows:
JreMemoryLeakPreventionListener, a listener to prevent memory overflows.
The copy code is as follows:
GlobalResourcesLifecycleListener, initializing the global JNDI resource defined under the element GlobalNamingResources
The copy code is as follows:
ThreadLocalLeakPreventionListener to prevent ThreadLocal from overflowing listeners.
GlobalNamingResources
GlobalNamingResources defines the global JNDI resource for Server. Can be referenced for all engine applications.
A JNDI is defined in the configuration file, called UserDatabase, which uses the contents of conf/tomcat-users.xml to get a database for authorized users, which is an in-memory database.
Service
. . .
There can be multiple Service,Service under Server, multiple Connector and one Engine under it. The default Service name here is Catalina, and there are two Connector:Http and AJP below.
The name displayed by name,Service must be unique.
Connector
The above is the Connector used to process http requests.
Port, port number 8080.
Protocol, protocol, http protocol
ConnectionTimeout, the maximum waiting time for the response, 20 seconds
RedirectPort,ssl requests are redirected to port 8443
Above is the use of thread pools to handle http requests.
The above handles ssl requests and port is 8443.
The above handles AJP requests, and you can run tomcat with apache's http server.
Engine
Engine is a container, and a Service contains only one Engine:
...
The Engine can contain one or more Host. Engine maps from the hostname or ip in the header information requested by http to the real host.
The name of name,Engine needs to be unique.
DefaultHost, default hostname
Cluster
Cluster-related configuration. Tomcat supports server clusters, which can copy the reply and context properties of the entire cluster, or deploy a war package to all clusters.
Realm
Realm is a database containing user, password, and role, and Realm can be defined in any container. Authentication is done here through the external resource UserDatabase.
Host
Host virtual host is defined under Engine. There can be multiple Host under one Engine and multiple Context under one Host.
Name, the network name of the virtual host, must have a host name that is the same as Engine's defaulHost.
AppBase, the root directory of the virtual host application. The default is webapps.
UnpackWARs, whether the war file in the webapps directory should be unzipped.
AutoDeploy. When the value is true, tomcat periodically checks directories such as appBase to deploy new web applications and Context description files.
Value
Value here means valve, can intercept http requests, and can be defined in any container.
SingleSignOn is a single sign-on, and AccessLogValve is a record of access logs.
This is the end of this article on "sample analysis of the configuration file server.xml in tomcat7". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
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.