Tomcat virtual host server. xml introduces sub-file configuration tutorial

Source: Internet
Author: User
Tags server port tomcat

When configuring the tomcat virtual host, how does one write a separate file for each virtual host? server. xml contains these subfiles? For example, in OneinStack, the details of the tomcat configuration file after the JAVA environment virtual host is added:

/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 cl AssName = "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 that 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 "release =" true "enableLookups =" false "URIEncoding =" UTF-8 "/> <Engine name =" Catalina "defaultHost =" localhost "> <Realm className =" org. apache. catalina. realm. lockOutRealm "> <Realm className =" org. apache. catalina. realm. userDatabaseRealm "resourceName =" 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">]>

In the <Engine>... </Engine] reference it (localhost-vhost.

The following is a file for each individual VM:

/Usr/local/tomcat/conf/vhost/localhost. xml <Host name = "localhost" appBase = "webapps" unpackWARs = "true" autoDeploy = "true"> <Context path = "" docBase = "/home/wwwroot/default" debug = "0" reloadable = "true" crossContext = "true"/> <Valve className = "org. apache. catalina. valves. accessLogValve "directory =" 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 <Host name = "demo.linuxeye.com" appBase = "webapps" unpackWARs = "true" autoDeploy = "true"> <Context path = "" docBase = "/home/wwwroot/demo.linuxeye.com" debug = "0" reloadable = "true" crossContext = "true"/> <Valve className = "org. apache. catalina. valves. accessLogValve "directory =" 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 <Host name = "java.linuxeye.com" appBase = "webapps" unpackWARs = "true" autoDeploy = "true"> <Alias> java1.linuxeye.com </Alias> <Context path = "" docBase =" "/home/wwwroot/java.linuxeye.com" debug = "0" reloadable = "true" crossContext = "true"/> <Valve className = "org. apache. catalina. valves. accessLogValve "directory =" logs "prefix =" java.linuxeye.com _ access_log. "suffix = ". txt "pattern =" % h % l % u % t & quot; % r & quot; % s % B "/> </Host>

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.