Tomcat multi-domain configuration and tomcat Domain Configuration
1. Find your tomcat and Open server. xml in the conf file;
<Serverport ="8005"Shutdown ="SHUTDOWN">
<ListenerclassName ="
Org. apache. catalina. core. AprLifecycleListener"SSLEngine ="
On"/>
<ListenerclassName ="
Org. apache. catalina. core. JasperListener"/>
<ListenerclassName ="
Org. apache. catalina. mbeans. ServerLifecycleListener"/>
<ListenerclassName ="
Org. apache. catalina. mbeans. GlobalResourcesLifecycleListener"/> <GlobalNamingResources>
<Resourcename ="
UserDatabase"Auth ="
Container"Type ="
Org. apache. catalina. UserDatabase"Description ="
User database that can be updated andsaved"Factory ="
Org. apache. catalina. users. MemoryUserDatabaseFactorY"Pathname ="
Conf/tomcat-users.xml"/> </GlobalNamingResources> <Servicename ="
Catalina">
<Connectorport ="
8080"Protocol ="
HTTP/1.1"MaxThreads ="
150"ConnectionTimeout ="
20000"RedirectPort ="
8443"/> <! -- <Connector port = "8443" protocol = "HTTP/1.1" SSLEnabled = "true"
MaxThreads = "150" scheme = "https" secure = "true"
ClientAuth = "false" sslProtocol = "TLS"/>
-->
<Connectorport ="
8009"Protocol ="
AJP/1.3"RedirectPort ="
8443"/>
<Enginename ="
Catalina"DefaultHost ="
Localhost"> <! -- <ClusterclassName = "org. apache. catalina. ha. tcp. SimpleTcpCluster"/>
--> <! -- <ValveclassName = "org. apache. catalina. valves. RequestDumperValve"/>
-->
<RealmclassName ="
Org. apache. catalina. realm. UserDatabaseRealm"ResourceName ="
UserDatabase"/> <Hostname ="
Localhost"AppBase ="
Webapps"UnpackWARs ="
True"AutoDeploy ="
True"XmlValidation ="
False"XmlNamespaceAware ="
False"> <! -- <ValveclassName = "org. apache. catalina. authenticator. SingleSignOn"/>
--> <! -- <ValveclassName = "org. apache. catalina. valves. AccessLogValve" directory = "logs"
Prefix = "localhost_access_log." suffix = ". txt" pattern = "common" resolveHosts = "false"/>
--> </Host> </Engine> </Service> </Server> here, I mainly modify the two places: the first one will <Connectorport ="
8080"Protocol ="
HTTP/1.1"MaxThreads ="
150"ConnectionTimeout ="
20000"RedirectPort ="
8443"/> Changed to: <Connectorport ="
80"Protocol ="
HTTP/1.1"MaxThreads ="
150"ConnectionTimeout ="
20000"RedirectPort ="
8443"/> Second, add <Hostname ="
Localhost"AppBase ="
Webapps"UnpackWARs ="
True"AutoDeploy ="
True"XmlValidation ="
False"XmlNamespaceAware ="
False" />
</Engine> change to <Engine name ="
Catalina"DefaultHost =
Www.abc.com>
<Hostname = "www.coe.com" appBase ="
Webapps"UnpackWARs ="
True"AutoDeploy ="
True"XmlValidation ="
False"XmlNamespaceAware ="
False" > <Contextpath = "" docbase ="
D: \ Tomcat6.0 \ webapps \ ROOT"Crosscontext ="
True"/> </Host>
<Hostname ="
Www. abc. Com"AppBase ="
Ccc"UnpackWARs ="
True"AutoDeploy ="
True" XmlValidation ="
False"XmlNamespaceAware ="
False">
<Contextpath = "" docbase ="
D: \ Tomcat 6.0 \ ccc \ ROOT"Crosscontext ="
True"/> </Host>
<Host name =
Www. CBA .comAppBase ="
Dddd"UnpackWARs ="
True"AutoDeploy ="
True"XmlValidation ="
False"XmlNamespaceAware ="
False"/> <Contextpath =" "docbase ="
D: \ Tomcat6.0 \ dddd \ ROOT"Crosscontext ="
True"/> </Host>
</Engine> tomcat directory configuration is as follows:
Both ccc and dddd are independent projects, and each project must be placed in the root folder for multi-domain access.