(1): directory structure
The directory structure of Tomcat is as follows:
Directory Name: overview
Bin: stores scripts for starting and disabling tomcat.
Conf: contains different configuration files, server. XML (main configuration file of Tomcat) and Web. xml
Work: stores the class files generated after JSP compilation.
Webapp: stores applicationsProgramFor example, the application you want to deploy will also be placed in this directory.
Logs: stores log files.
LIB/japser/common: these three directories mainly store the jar files required by Tomcat.
(2) server. xml configuration overview
Server:
Port specifies a port, which is used to listen for requests to disable tomcat.
Shutdown specifies the command string sent to the port
Service:
Name indicates the service name.
Connector (indicating the connection between the client and the Service ):
Port: Specifies the port number to be created on the server, and listens to requests from the client on this fracture.
Number of threads created to process requests when the minprocessors server is started
Maxprocessors: Maximum number of threads that can be created to process requests
If enablelookups is true, you can call request. getremotehost () to query the DNS to obtain the actual Host Name of the remote client. If it is false, no DNS query is performed, but the IP address is returned.
Redirectport specifies the port number to be redirected after receiving an SSL transfer request when the server is processing an HTTP request
Acceptcount indicates the number of requests that can be placed in the processing queue when the number of threads that can be used to process requests is used. requests exceeding this number will not be processed.
Connectiontimeout specifies the timeout time (in milliseconds)
Engine (indicates the request processing machine in the specified service to receive and process requests from ctor ):
Defaulthost specifies the default host name for processing requests. It is at least the same as the name attribute value of one of the host elements.
Context (a web application, usually a war file. For details about war, see servlet specifications ):
Docbase application path or war file storage path
Path indicates the prefix of the URL of the Web application. The requested URL is http: // localhost: 8080 /****
Reloadable this property is very important, if it is true, Tomcat will automatically detect changes to the application's/WEB-INF/lib and/WEB-INF/classes directory, automatically load the new application, we can change the application without restarting tomcat.
Host (ONE ):
Name specifies the Host Name
The basic directory of the appbase application, that is, the directory where the application is stored.
If unpackwars is true, Tomcat automatically decompress the war file. Otherwise, the application runs directly from the war file.
Logger (indicating logs, debugging, and error messages ):
Classname specifies the class name used by logger. This class must implement the org. Apache. Catalina. logger interface
Prefix specifies the prefix of the log file
Suffix specifies the suffix of the log file
If timestamp is true, the time must be added to the log file name, as shown below:
Example: localhost_log.2001-10-04.txt
Realm (indicates the database that stores the username, password, and role ):
Classname specifies the class name used by realm. This class must implement the org. Apache. Catalina. realm Interface
Valve (similar to logger, its prefix and suffix attributes are interpreted as the same as those in logger ):
Classname specifies the class name used by valve. For example, the org. Apache. Catalina. Valves. accesslogvalve class can be used to record application access information.
Directory specifies the location where log files are stored
Pattern has two values. The common method records the remote host name or IP address, user name, date, the string of the first line request, and the HTTP response.CodeThe number of bytes sent. The combined method has more values than the common method.
(3) Tomcat Management
For specific management, we need to add a user to Tomcat so that this user has the permission to manage.
Open the tomcat-users.xml file under the conf directory and add the following line at the appropriate location:
<User name = "ZF" Password = "ZF" roles = "standard, Manager"/>
Note: the last part of this line must be/>. The/symbol is removed from the Tomcat document. If there is no/symbol, the application cannot be accessed when Tomcat restarts. You can view the error details in the logs/Catalina. Out file.