<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 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>
<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. <connector> elements represent customersProgramThe actual interaction sender, which 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 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> port: Set the TCP/IP Port. The default value is 8080. If you change 8080 to 80, you only need to enter Http: // localhost Yes
because the default TCP/IP Port is 80
3> address: if the server has more than two IP addresses, you can set the IP address of the port listening. 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> Protocol sets the HTTP 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 client requests that the server can respond to at the same time. the default value is 200
7> acceptcount. It is set to the maximum number of customer requests in the listening 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 the value is-1, the time for establishing a client connection is not limited.
jkconnector attributes
1> classname implements connector's Class
2> port setting AJP port number
3> protocol must be set to AJP/1.3
note: * **********************
tomcat5.0 and tomcat5.5 servers. the XML file configuration is different. Because the context configuration of tomcat5.5 is extracted from the server. xml file and configured independently, you must use the resourcelink element to specify it. The following is a configuration Demo:
in this example, the project application name is Stu, that is, the container name. 1. Configure the STU/WEB-INF/Web. xml file to add the following Code :
database: Student JNDI JDBC/STU javax. SQL. datasource container retriable