A. Tomcat directory structure
/bin: Script file to start and close Tomcat on a Windows or Linux platform
/conf: A variety of global configuration files for the Tomcat server, the most important of which is server.xml and Web. xml
/doc: Storing Tomcat documents
/SERVER: Contains three subdirectories: Classes, lib, and WebApps
/server/lib: Various jar files required to store the Tomcat server
/server/webapps: Two Web App admin apps and manager apps to store Tomcat
/common/lib: A jar file that holds the Tomcat server and all Web apps that can access it
/shared/lib: Store jar files accessible to all Web apps (but not accessed by Tomcat server)
/logs: Storing log files for tomcat execution
/SRC: Storing Tomcat's source code
/webapps:tomcat's main Web publishing directory, where Web application files are placed by default in this directory
/work: Store the class file generated by JSP compilation
Second, the directory structure of Web applications: Assume that there are helloapp Web applications under $catalina_home/webapps
/helloapp:web application root directory, all JSP files and HTML files are in this directory
/helloapp/web_inf: A description file for the WEB app when it was published. xml
/helloapp/web_inf/class: Storage of various class files, servlet files are also stored in this directory
/helloapp/web_inf/lib: Store the jar files needed for each clock WEB application. For example, a jar file that can hold the JDBC driver
Third, Tomcat loads classes and resources in the order of (take the HelloApp application as an example):
1, HelloApp (/webapps/helloapp/web-inf/under the Classes,lib subdirectory *.CALSS and *.jar, only HelloApp can be loaded)
2, Bootstrap ($JAVA _home/jre/lib/ext/*.jar)
3. System ($CLASSPATH the jar specified in/*.class and CLASSPATH)
4, Common ($CATALINA _home/common/under the Classes,lib,endores subdirectory *.class and *.jar)
5, Catalina ($CATALINA _home/server/under the Classes,lib subdirectory *.CALSS and *.jar, only Tomcat can be loaded)
6, Shared ($CATALINA _home/shared/under the Classes,lib subdirectory *.CALSS and *.jar, only all Web apps can be loaded)
Four, $CATALINA _home/conf/server.xml configuration Introduction
1. Element attributes
Port: Specify one of the ports that listens for requests to close Tomcat
Shutdown: Specifies the command string to send to the port, typically "shutdown"
2. Element attributes
Name: Specifies the name of the service, usually "Catalina"
3, Element attribute (indicates the connection between client and service):
Port: Specify the port number to be created on the server side and use this fracture to listen for requests from the client
Minprocessors (check for this property): The number of threads that were created at server-side startup to process requests
Maxprocessors (see if this attribute is available): Maximum number of threads that can be created to process requests
MaxThreads: Maximum number of threads created by the server
Minsparethreads: Minimum number of remaining threads
Maxsparethreads: Maximum number of remaining threads
Enablelookups: If True, you can make a DNS query by calling Request.getremotehost () to get the actual hostname of the remote client, or false to not make the DNS query, but instead return its IP address
Redirectport: Specifies the port number that is redirected when the server receives an SSL transfer request when it is processing an HTTP request
Acceptcount: Specifies the number of requests that can be placed into the processing queue when all the threads that can be used to process the request are used, and requests that exceed the request will not be processed
ConnectionTimeout: Specifies the number of times to time out (in milliseconds)
Disableuploadtimeout: Unknown
Debug: Unknown
Protocol: Unknown
4, Element properties (Specify the request processing host in the service, receive and process requests from connector)
Name: Specifies the engine names, usually "Catalina"
Defaulthost: Specifies the default host name for processing requests, at least the same as the Name property value of a host element
5. Element attributes (representing a Web application)
DocBase: Specifies the absolute or relative path to this web app, or the path to the war file
Path: The portal that represents the URL for this Web application, such as "/hello", the requested URL is http://localhost:8080/hello/
Reloadable: If True, Tomcat automatically monitors changes to files under/web-inf/lib and/web-inf/classes in the WEB app at run time, automatically loading new apps, Allows us to update the Web app without restarting Tomcat
6. Element attribute (indicates a virtual host)
Name: Specify the virtual host name
Debug: Specify the log level
AppBase: The base directory for the Web application, which can be an absolute path or a directory relative to $catalina_home, by default $catalina_home/webapps
Unpackwars: If True, Tomcat will automatically unzip the war file and run it, otherwise it will run the application directly from the war file.
Autodeploy: True indicates that all Web apps (including newly added web apps) are automatically published in the AppBase directory when Tomcat starts
Deployonstarup: If this is true, it means that all web apps under the AppBase directory are automatically published when the Tomcat server starts. If the web app does not have a corresponding element in Server.xml, the default context configuration will be used. The default setting for Deployonstarup is True
Alias: Specifies the alias of the virtual host, multiple aliases can be specified
Xmlvalidation: Unknown
Xmlnamespaceaware: Unknown
7. Element attributes (indicating log, debug and error messages)
ClassName: Specifies the class name used by Logger, which must implement the Org.apache.catalina.Logger interface
Prefix: Specifies the prefix (filename) of the log file name
Suffix: Specifies the suffix of the log file name (extension)
Timestamp: If True, a DateTime is added to the log file name, as in the following example: Localhost_log.2006-10-04.txt
Directory: Specify the directories where log files are stored
8, Element attribute (indicates the database that holds user name, password and role)
ClassName: Specifies the class name used by realm, this class must implement the Org.apache.catalina.Realm interface
ResourceName: Unknown
9, element attributes (function and logger similar, its prefix and suffix attribute interpretation and logger the same)
ClassName: Specifies the class name that Valve uses, such as using the Org.apache.catalina.valves.AccessLogValve class to record access information for an application
Directory: Specify where log files are stored
Pattern: There are two values, the common method records the remote host name or IP address, user name, date, the first line of the requested string, the HTTP response code, the number of bytes sent. Combined way more values than common way record
Tomcat directory Structure