Server.xml Introducing sub-file configuration (Tomcat virtual host) [Go]

Source: Internet
Author: User

When configuring a Tomcat virtual host, how can each virtual host be written as a separate file, Server.xml contains these sub-files? In the following "Oneinstack", add the Java environment Virtual host after the Tomcat configuration file details:

/usr/local/tomcat/conf/server.xml

<?XML version="1.0"Encoding="UTF-8"?><! DOCTYPE Server-xml [<! ENTITY localhost-vhost SYSTEM "File:///usr/local/tomcat/conf/vhost/localhost.xml" ><! ENTITY java.linuxeye.com-vhost SYSTEM "File:///usr/local/tomcat/conf/vhost/java.linuxeye.com.xml" ><! ENTITY demo.linuxeye.com-vhost SYSTEM "File:///usr/local/tomcat/conf/vhost/demo.linuxeye.com.xml" >]><server Port="8006" Shutdown="SHUTDOWN"> <listener ClassName="Org.apache.catalina.core.JreMemoryLeakPreventionListener"/> <listener ClassName="Org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/> <listener ClassName="Org.apache.catalina.core.ThreadLocalLeakPreventionListener"/> <listener ClassName="Org.apache.catalina.core.AprLifecycleListener"/><!--<listener classname= "Org.apache.catalina.mbeans.JmxRemoteLifecycleListener" rmiregistryportplatform= " 8081 "rmiserverportplatform=" 8082 "/>--> <GlobalNamingResources> <resource Name="Userdatabase" Auth="Container" Type="Org.apache.catalina.UserDatabase" Description=User database, can be updated and saved Factory="Org.apache.catalina.users.MemoryUserDatabaseFactory" Pathname="Conf/tomcat-users.xml" /> </GlobalNamingResources> <service Name="Catalina"> <connector Port="8080" Protocol="Org.apache.coyote.http11.Http11AprProtocol" ConnectionTimeout="20000" Redirectport="8443" MaxThreads="1000" Minsparethreads="20" Acceptcount="1000" Debug="0" Disableuploadtimeout="True" Usebodyencodingforuri="True" Enablelookups="False" Uriencoding="UTF-8" /> <engine Name="Catalina" Defaulthost="LocalHost"> <realm  Classname= "Org.apache.catalina.realm.LockOutRealm" >< Span class= "PLN" > <realm classname=< Span class= "ATV" > "Org.apache.catalina.realm.UserDatabaseRealm"  resourcename< Span class= "pun" >= "userdatabase" />  </realm> &localhost-vhost; &java.linuxeye.com-vhost; &demo.linuxeye.com-vhost ; </engine> </service></SERVER>            

Note: Add the following format before the <server> element:

<! DOCTYPE Server-xml [  <! ENTITY localhost-vhost SYSTEM "File:///usr/local/tomcat/conf/vhost/localhost.xml" >]>

and <engine>...</engine] To reference it (Localhost-vhost).

The following are each individual virtual host file:
/usr/local/tomcat/conf/vhost/localhost.xml

<HostName="LocalHost"AppBase="WebApps"Unpackwars="True"Autodeploy="True"> <ContextPath=""DocBase="/data/wwwroot/default" Debug= "0"  Reloadable=  "true"  Crosscontext= "true" /> <valve= "org.apache.catalina.valves.AccessLogValve" = "logs"  Prefix=  "Localhost_access_log."  Suffix= ". txt"  Pattern = "%h%l%u%t &quot;%r&quot; %s%b " />           

/usr/local/tomcat/conf/vhost/demo.linuxeye.com.xml

<HostName="Demo.linuxeye.com"AppBase="WebApps"Unpackwars="True"Autodeploy="True"> <ContextPath=""DocBase="/data/wwwroot/demo.linuxeye.com" Debug= "0"  Reloadable=  "true"  Crosscontext= "true" /> <valve= "org.apache.catalina.valves.AccessLogValve" = "logs"  Prefix=  "Demo.linuxeye.com_access_log."  Suffix= ". txt"  Pattern = "%h%l%u%t &quot;%r&quot; %s%b " />           

/usr/local/tomcat/conf/vhost/java.linuxeye.com.xml

 Name="Java.linuxeye.com" AppBase="WebApps" Unpackwars="True" Autodeploy="True"> <Alias>Java1.linuxeye.com</Alias> <context Path="" DocBase="/data/wwwroot/java.linuxeye.com" Debug="0" Reloadable="True" crosscontext= "true" />  <valve classname=< Span class= "ATV" > "org.apache.catalina.valves.AccessLogValve"  directory= "logs"  prefix=  "Java.linuxeye.com_access_log."  suffix= ". txt"  pattern= /></HOST>    

Server.xml Introducing sub-file configuration (Tomcat virtual host) [Go]

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.