Element name |
Attribute |
Explanation |
Server |
Port |
Specifies a port to listen for requests to disable tomcat. |
Shutdown |
Specifies the command string sent to the port |
Service |
Name |
Service name |
Connector (indicating the connection between the client and the Service) |
Port |
Specify the port number to be created on the server and listen to requests from the client at this break. |
Minprocessors |
Number of threads created when the server is started to process requests |
Maxprocessors |
Maximum number of threads that can be created to process requests |
Enablelookups |
If the value is true, you can call request. getremotehost () for DNS query to obtain the actual Host Name of the remote client. If the value is false, no DNS query is performed, but the IP address is returned. |
Redirectport |
Specifies the port number to be redirected after the server receives an SSL transfer request when processing an HTTP request. |
Acceptcount |
Specify the number of threads that can be used to process requests, and the number of requests that can be placed in the processing queue. Requests that exceed this number will not be processed. |
Connectiontimeout |
Time-out period (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 must be 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/path /**** |
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 (a virtual host) |
Name |
Specify the Host Name |
Appbase |
The basic application directory, that is, the directory where the application is stored. |
Unpackwars |
If this parameter is set to true, Tomcat automatically decompress the war file. Otherwise, the application is directly run 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 |
Specify the log file prefix |
Suffix |
Specify the suffix of the log file |
Timestamp |
If true, time is added to the log file name, as shown in the following example: localhost_log.2001-10-04.txt |
Realm (indicates the database that stores the user name, 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 |
Location where log files are stored |
Pattern |
There are two values: Remote Host Name or IP address, user name, date, string of the first line of request, HTTP response code, and number of bytes sent in common mode. The combined method has more values than the common method. |
<Server> element
It represents the entire container and is the top-level element of the Tomcat instance. by Org. apache. catalina. server interface to define. it contains a <service> element. it cannot be a child element of any element. <server port = "8005" shutdown = "shutdown" DEBUG = "0">
1> classname specifies the class that implements the org. Apache. Catalina. server interface. The default value is org. Apache. Catalina. Core. standardserver.
2> port: Specifies the port for Tomcat to listen to the shutdown command. When the server is terminated, the shutdown command must be issued on the machine where the Tomcat server is located. This attribute is required.
3> shutdown specifies the string of the shutdown listening port sent to the Tomcat server when the Tomcat server is terminated. This attribute must be set
<Service> element
This element is defined by the org. Apache. Catalina. service interface. It contains one <engine> element and one or more <connector> elements that share the same engine element.
<Service name = "Catalina">
<Service name = "Apache">
The first <service> process all Web client requests directly received by the Tomcat server.
The second <service> process all Web client requests forwarded by the apahce Server
1> classname specifies the class that implements the org. apahce. Catalina. service interface. The default value is org. apahce. Catalina. Core. standardservice.
2> name defines the service name
<Engine> element
Each service element can have only one engine element. the element processes customer requests received by all <connector> elements in the same <service>. by Org. apahce. catalina. engine interface definition. <engine name = "Catalina" defaulthost = "localhost" DEBUG = "0"> 1> classname specifies the class to implement the engine interface. The default value is standardengine.
2> defaulthost specifies the default host name for processing the customer. This host must be defined in the 3> name defines the engine name
The <engine> can contain <logger>, <realm>, <value>, and It is defined by the host interface. an engine element can contain multiple 2> appbase: Specifies the virtual host directory. You can specify an absolute directory or a relative directory relative to <catalina_home>. If this option is not available, the default value is <catalina_home>/webapps.
3> autodeploy if this option is set to true, it indicates that when the Tomcat service is running, files under appbase can be monitored. If a new Web application is added, the Web application will be released automatically.
4> unpackwars: If this option is set to true, the war file of the Web application is expanded to an open directory structure before running. If this option is set to false, the war file is directly run.
5> alias specifies the host alias. You can specify multiple aliases.
6> deployonstartup if this option is set to true, all web applications under the appbase directory will be automatically published when the Tomcat server is started. if the server. XML does not have the corresponding <context> element. The default context of Tomcat is used.
7> name defines the name of the VM.
The <Logger>, <realm>, <value>, <context> element
It is defined by the context interface. is the most frequently used element. each <context element represents a single web application running on the VM. one A corresponding context represents the web application itself. The servlet container creates
Servletcontext object. <context Path = "/sample" docbase = "sample" DEBUG = "0" reloadbale = "true"> 1> classname specifies the class that implements the context. The default value is the standardcontext class.
2> path specifies the URL entry for accessing the web application. Note/myweb instead of myweb.
3> reloadable if this property is set to true, the Tomcat server will monitor the change in the class file in the WEB-INF/classes and web-INF/lib directory while running. if a class file is updated, the server automatically reloads the web application.
3> cookies specify whether the session is supported through cookies. The default value is true.
4> usenaming specifies whether JNDI is supported. The default value is true. The <context> element can contain the following elements:
<Logger>, <realm>, <resource>, <resourceparams>
<Connector> element
Defined by connector interface. the <connector> element represents the delivery that actually interacts with the customer program. It is responsible for receiving customer requests and returning response results to the customer. <connector Port = "8080" maxthread = "50" minsparethreads = "25" maxsparethread = "75"
Enablelookups = "false" redirectport = "8443" acceptcount = "100" DEBUG = "0"
Connectiontimeout = "20000" disableuploadtimeout = "true"/>
<Connection Port = "8009" enablelookups = "false" redirectport = "8443" DEBUG = "0"
Protocol = "AJP/1.3"/> the first connector element defines an HTTP connector, which receives HTTP requests through port 8080; the second connector element defines a JD connector, it receives requests forwarded by other servers through port 8009.
Connector element sharing attributes
1> classname specifies the class to implement the connector Interface
2> If enablelookups is set to true, domain name resolution is supported. You can resolve the IP address to the host name. In the web application, call request. getremotehost to return the client host name. The default value is true.
3> redirectport specifies the forwarding port. If the current port only supports non-SSL requests, the customer request will be forwarded to the SSL redirectport in the field requiring secure communication.
Attribute of the httpconnector Element
1> classname: class for implementing ctor
2> set the TCP/IP Port for port. The default value is 8080. If you change 8080 to 80, you only need to enter http: // localhost.
Because the default port of TCP/IP is 80
3> address: if the server has more than two IP addresses, you can set the IP address of the port listener. By default, the port listens to all IP addresses on the server.
4> buffersize: sets the cache size of the input stream created by the port. The default value is 2048 bytes.
5> set the HTTP protocol for protocol. The default value is HTTP/1.1.
6> maxthreads sets the maximum number of threads on the listening port. This value also determines the maximum number of threads that the server can respond to customer requests at the same time. The default value is 200.
7> acceptcount is set to the maximum number of customer requests in the listener port queue. The default value is 10. If the queue is full, the customer must wait.
8> connectiontimeout defines the timeout time for establishing a client connection. If the value is-1, the time for establishing a client connection is not limited.
Jkconnector attributes
1> classname: class for implementing ctor
2> set the AJP port number for Port
3> protocol must be set to AJP/1.3 ============================== ========================================================== ========================
<Server> element
It represents the entire container and is the top-level element of the Tomcat instance. by Org. apache. catalina. server interface to define. it contains a <service> element. it cannot be a child element of any element.
<Server port = "8005" shutdown = "shutdown" DEBUG = "0">
1>Classname specifies the class that implements the org. Apache. Catalina. server interface. The default value is org. Apache. Catalina. Core. standardserver.
2>Port: Specifies the port for Tomcat to listen to the shutdown command. When the server is terminated, the shutdown command must be issued on the machine where the Tomcat server is located. This attribute is required.
3>Shutdown specifies the string of the shutdown listening port sent to the Tomcat server when the Tomcat server is terminated. This attribute must be set
<Service> element
This element is defined by the org. Apache. Catalina. service interface. It contains one <engine> element and one or more <connector> elements that share the same engine element.
<Service name = "Catalina">
<Service name = "Apache">
The first <service> process all Web client requests directly received by the Tomcat server.
The second <service> process all Web client requests forwarded by the apahce Server
1>Classname specifies the class that implements the org. apahce. Catalina. service interface. The default value is org. apahce. Catalina. Core. standardservice.
2>Name defines the service name
<Engine> element
Each service element can have only one engine element. The element processes customer requests received by all <connector> elements in the same <service>. This is defined by the org. apahce. Catalina. Engine interface.
<Engine name = "Catalina" defaulthost = "localhost" DEBUG = "0">
1>Classname specifies the class that implements the engine interface. The default value is standardengine.
2>Defaulthost specifies the default host name for processing the customer. This host must be defined in the 3>Name defines the engine name
<Engine> can contain the following elements: <logger>, <realm>, <value>, and
<Host> element
It is defined by the host interface. An engine element can contain multiple
<Host name = "localhost" DEBUG = "0" appbase = "webapps" unpackwars = "true" autodeploy = "true">
1>Classname specifies the class that implements the host interface. The default value is standardhost.
2>Appbase specifies the virtual host directory. You can specify an absolute directory or a relative directory relative to <catalina_home>. If this option is not set, the default value is <catalina_home>/webapps.
3>Autodeploy if this parameter is set to true, it indicates that when the Tomcat service is running, files under appbase can be monitored. If a new Web application is added, the Web application will be released on its own.
4>Unpackwars if this option is set to true, the war file of the Web application is expanded to an open directory structure before running. If it is set to false, the war file is run directly.
5>Alias specifies the host alias. You can specify multiple aliases.
6>Deployonstartup if this parameter is set to true, all web applications under the appbase directory will be automatically published when the Tomcat server is started. if the server. XML does not have the corresponding <context> element. The default context of Tomcat is used.
7>Name indicates the name of the VM.
The
<Logger>, <realm>, <value>, <context>
<Context> element
It is defined by the context interface. is the most frequently used element. each <context element represents a single web application running on the VM. one A corresponding context represents the web application itself. The servlet container creates
Servletcontext object.
<Context Path = "/sample" docbase = "sample" DEBUG = "0" reloadbale = "true">
1>Classname specifies the class that implements the context. The default value is the standardcontext class.
2>Path specifies the URL entry to access the Web application. Note/myweb, instead of myweb.
3>Reloadable if this property is set to true, the Tomcat server will monitor the change in the class file in the WEB-INF/classes and web-INF/lib directory while running. if a class file is updated, the server automatically reloads the web application.
3>Indicates whether the session is supported through cookies. The default value is true.
4>Usenaming specifies whether JNDI is supported. The default value is true.
The <context> element can contain the following elements:
<Logger>, <realm>, <resource>, <resourceparams>
Connector Element
Defined by the connector interface. The <connector> element represents the deliverable that actually interacts with the customer program. It is responsible for receiving customer requests and returning response results to the customer.
<Connector Port = "8080" maxthread = "50" minsparethreads = "25" maxsparethread = "75" enablelookups = "false" redirectport = "8443" acceptcount = "100" DEBUG =" 0 "connectiontimeout =" 20000 "disableuploadtimeout =" true "/>
<Connection Port = "8009" enablelookups = "false" redirectport = "8443" DEBUG = "0" protocol = "AJP/1.3"/>
The first connector element defines an HTTP connector, which receives HTTP requests through port 8080, and the second connector element defines a JD connector, it receives requests forwarded by other servers through port 8009.
Connector element sharing attributes
1>Classname specifies the class that implements the connector Interface
2>If enablelookups is set to true, domain name resolution is supported. You can resolve the IP address to the host name. The web application calls the request. getremotehost method to return the client host name. The default value is true.
3>Redirectport specifies the forwarding port. If the current port only supports non-SSL requests, the customer request will be forwarded to the SSL redirectport in the field requiring secure communication.
Attribute of the httpconnector Element
1>Classname class for connector implementation
2>Port: Set the TCP/IP Port. The default value is 8080. If you change 8080 to 80, you only need to enter http: // localhost.
Because the default port of TCP/IP is 80
3>Address if the server has more than two IP addresses, you can set the IP address of the port listener. By default, the port listens to all IP addresses on the server.
4>Buffersize: Set the cache size of the input stream created by the port. The default value is 2048 bytes.
5>Set the HTTP protocol for protocol. The default value is HTTP/1.1.
6>Maxthreads sets the maximum number of threads on the listening port. This value also determines the maximum number of threads that the server can respond to customer requests at the same time. The default value is 200.
7>Acceptcount indicates the maximum number of customer requests in the listener port queue. The default value is 10. If the queue is full, the customer must wait.
8>Connectiontimeout defines the timeout time for establishing a customer connection. If it is-1, the time for establishing a customer connection is not limited.
Jkconnector attributes
1>Classname class for connector implementation
2>Port: Set the AJP port number.
3>Protocol must be set to AJP/1.3