Server.xml 注释
Server:
Server只能有一个,它代表整个JVM,server可以包含一个或者多个service
Service:
service包含一个或者多个connector和container。
Conector:
connector用来为container领受请求,和返回响应的。
Engine:
engine是顶层container,它可以包含一个或者多个host
Host:
host是虚拟主机,它可以包含一个或者多个context
Context:
context对应一个web application。
比来抽时刻研究了一下tomcat的源码,发现可以增添多个Service到server.xml中,实此刻tomcat中跑多个处事器实例,在Server.xml中增添如下设置装备摆设信息:
Xml代码
《Service name=“Catalina2”》
《Connector port=“8081”
maxThreads=“150” minSpareThreads=“25” maxSpareThreads=“75”
enableLookups=“false” redirectPort=“8443” acceptCount=“100”
debug=“0” connectionTimeout=“20000”
disableUploadTimeout=“true” /》
《Connector port=“8010”
enableLookups=“false” redirectPort=“8443” debug=“0”
protocol=“AJP/1.3” /》
《Engine name=“Catalina” defaultHost=“localhost” debug=“0”》
《Logger className=“org.apache.catalina.logger.FileLogger”
prefix=“catalina2_log.” suffix=“。txt”
timestamp=“true”/》
《Realm className=“org.apache.catalina.realm.UserDatabaseRealm”
debug=“0” resourceName=“UserDatabase”/》
《Host name=“localhost” debug=“0” appBase=“webapps2”
unpackWARs=“true” autoDeploy=“true”
xmlValidation=“false” xmlNamespaceAware=“false”》
《Logger className=“org.apache.catalina.logger.FileLogger”
directory=“logs” prefix=“localhost2_log.” suffix=“。txt”
timestamp=“true”/》
《/Host》
《/Engine》
《/Service》