Tomcat configuration files

Tomcat directory structure:

. 1 [@ gz01 the root-Tomcat-amdha01 ~] # LL / usr / local / Tomcat /
 2 of the total amount of 124 
. 3 drwxr-X ---. 2 the root the root   4096 . 3 dated   28  01 : 09 bin
 . 4 -rw-r-- ---. . 1 the root the root 19318 . 3 dated   . 11  18 is : 06 BUILDING.txt
 . 5 drwx ------. . 3 the root the root    254 . 3 dated   28  01 : 12 is the conf
 . 6 . -rw-R & lt ----- . 1 the root root   5408 3 Yue   11  18:06 CONTRIBUTING.md
 7 drwxr-x---. 2 root root  4096 3月  28 01:09 lib
 8 -rw-r-----. 1 root root 57011 3月  11 18:06 LICENSE
 9 drwxr-x---. 2 root root   197 3月  28 01:12 logs
10 -rw-r-----. 1 root root  1726 3月  11 18:06 NOTICE
11 -rw-r-----. 1 root root  3255 3月  11 18:06 README.md
12 -rw-r-----. 1 root root  7136 3月  11 18:06 RELEASE-NOTES
13 -rw-r-----. 1 root root 16262 3月  11 18:06 RUNNING.txt
14 drwxr-x---. 2 root root    30 3月  28 01:09 temp
15 drwxr-x---. 7 root root    81 3月  11 18:04 webapps
16 drwxr-x---. 3 root root    22 3月  28 01:12 work

/ Bin: Scripts directory (start closed tomcat script file)

/ Lib: storage jar package

/ Conf: store configuration files

/ Logs: stored log file

/ Temp: Run time temporary files using tomcat

/ Webapps: web application directory publishing

/ Work: Tomcat generated by the various jsp servlet files in this directory. After deleting automatically created at startup.

 

. 1 [@ gz01 the root-tomcat- amdha01 the conf] LL #
 2 total amount of 224 
. 3 drwxr-X ---. . 3 the root the root      23 is . 3 dated   28  01 : 12 is Catalina
 . 4 . -Rw ------- . 1 the root the root   13446 3 Yue   11  18 : 06 catalina.policy 
 5 -rw -------. 1 root root    7661 3 Yue   11  18 : 06 catalina.properties
 6 . -rw ------- 1 root root    1338 3 month  11 18:06 context.xml
 7 -rw-------. 1 root root   1149 3月  11 18:06 jaspic-providers.xml
 8 -rw-------. 1 root root   2313 3月  11 18:06 jaspic-providers.xsd
 9 -rw-------. 1 root root   3916 3月  11 18:06 logging.properties
10 -rw-------. 1 root root   7588 3月  11 18:06 server.xml    
11 -rw-------. 1 root root   2164 3月  11 18:06 tomcat-users.xml
12 -rw-------. 1 root root   2633 3月  11 18:06 tomcat-users.xsd
13 -rw-------. 1 root root 171756 3月  11 18:06 web.xml

server.xml: Tomcat main configuration file that contains configuration information Service, Connector, Engine, Realm, Valve, Hosts the main assembly;

web.xml: follow the Servlet specification standard configuration files for configuring servlet, including MIME and provide maps and other information about the default configuration for all Web applications;

tomcat-user.xml: Information related to the role used when Realm authentication, user and password; Tomcat that comes with the case manager will use this file by default; Tomcat add / remove users, assign roles to users and so on through edit this file to achieve;

catalina.policy: Java-related security policy configuration file, the ability to provide access control at the level of system resources;

Catalina.properties:Tomcat defined inside the package and associated access control, including the control of content loaded by the class loader; Tomcat6 will read the relevant settings in this file in advance at startup;

logging.properties: Tomcat6 JAVA implemented by its own internal logger to log recording operations, the logging file that is associated configuration information can be used to define the component level and the presence of the log file of the logging and the like;

context.xml: By default, all host configuration information;

Tomcat architecture:

 

Tomcat It consists of a set of nested layers and components, it can generally be divided into the following four categories:

Top components: Located in the top-level configuration, and has a strict correspondence between each other;

Connector: The client (Web browser or may be a server) request to the Servlet container,

Containers: contains a set of other components;

Nested components: a container which is located, but does not include other components;

Each common components:

1, a server (server): a Tomcat instance, usually contains only a single JVM instance Tomcat; Thus, a single physical server can start a Tomcat instance in each of the JVM starts in a case where a plurality of the JVM, each examples belonging to a separate management port. This is a top-level assembly.

2, the service (service): a service component comprising an engine and a generally this engine associated with the one or more connectors. Named to the service administrator can easily identify the different services generated log in the log file. A service server may comprise a plurality of components, but usually only for a case assigned to a service server.

Connector class components:

3, a connector (connectors): responsible for connecting the client (Web browser or may be a server) to a requesting Web application within the Servlet container, generally refers to a port for receiving a position request sent by the client and server distribution. The default port is typically 8080 HTTP protocol, the administrator can change this port according to their needs. A plurality of connectors engine may be configured, these connectors must use different port. The default connector is based on HTTP / 1.1 is Coyote. At the same time, Tomcat also supports AJP, JServ and JK2 connector.

Container class components:

4, the engine (Engine): engine through means Servlet engine assembly process the request, i.e. Catalina Servlet engine, it checks HTTP each request header information to identify which host or context the request should be sent, and the request is processed the results returned by the corresponding client-side. Strictly speaking, the containers do not have to be achieved by the engine, it can also be just a container. If Tomcat is configured as a stand-alone server, the default engine is already defined engine. If Tomcat Servlet is configured to provide the back-end functionality of the Apache Web server, the default engine will be ignored, because the Web server itself can determine where to send a user request. An engine may comprise a plurality of host components.

5, the host (Host): Host component is similar to Apache virtual hosts, but only supports FQDN-based "virtual hosts" in Tomcat. At least one engine to include a host component.

6, the context (Context): Context component is the innermost level component that represents the Web application itself. Context is a main configuration designated root of the Web application, to a user request Servlet container can be sent to the correct position. Context assembly may also include a custom error page in order to achieve a friendly reminders when users access error occurred.

Are nested classes (nested) assembly:

Such assemblies typically comprise a container assembly to provide a service class having a management function, they do not include other components, but some may be each configured by the different levels of the container.

7, the valve (Valve): used to intercept the request and some processing operations before it is transferred to the target, similar to the Servlet specification defined filters. Valve assembly can be defined in any container class. Valve often used to record the client's request, the IP address information of the client and server, this technique is commonly referred to as a process dump request (request dumping). Dump valve recording request requesting client requests an HTTP packet header information and the cookie information file is recorded in response to the dump valve in response to the packet header information and the cookie information into a file.

8, Logger (Logger): recording status information for internal components, may be used for any other than the Context of the container. Logging function can be inherited, therefore, a level of engine Logger will record all internal engine components relevant information, unless an internal component defines its own Logger component.

9, the field (Realm): used for authentication and authorization of users; when configuring an application, the administrator can define roles for each resource or resource groups and permissions, and access control entry into force of these functions need to be implemented by Realm. Realm authentication can be based on text files, database tables, LDAP services to achieve. Realm utility would exist throughout the engine or top of the container, so all applications within a container will share user resources. Meanwhile, it may be Realm subassembly inheritance assembly may be covered with the quilt Realm assembly defined.

server.xml:

 

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <Server port="8005" shutdown="SHUTDOWN">
 3   <Listener className="org.apache.catalina.startup.VersionLoggerListener" />
 4   <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
 5   <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
 6   <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
 7   <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
 8   <GlobalNamingResources>
 9     <Resource name="UserDatabase" auth="Container"
10               type="org.apache.catalina.UserDatabase"
11               description="User database that can be updated and saved"
12               factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
13               pathname="conf/tomcat-users.xml" />
14   </GlobalNamingResources>
15   <Service name="Catalina">
16     <Connector port="8080" protocol="HTTP/1.1"
17                connectionTimeout="20000"
18                redirectPort="8443" />
19     <Engine name="Catalina" defaultHost="localhost">
20       <Realm className="org.apache.catalina.realm.LockOutRealm">
21         <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
22                resourceName="UserDatabase"/>
23       </Realm>
24 
25       <Host name="localhost"  appBase="webapps"
26             unpackWARs="true" autoDeploy="true">
27         <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
28                prefix="localhost_access_log" suffix=".txt"
29                pattern="%h %l %u %t &quot;%r&quot; %s %b" />
30       </Host>
31     </Engine>
32   </Service>
33 </Server>

 

Guess you like

Origin www.cnblogs.com/xiaozhebao/p/12586559.html