- 工信部备案号 滇ICP备05000110号-1
- 滇公安备案 滇53010302000111
- 增值电信业务经营许可证 B1.B2-20181647、滇B1.B2-20190004
- 云南互联网协会理事单位
- 安全联盟认证网站身份V标记
- 域名注册服务机构许可:滇D3-20230001
- 代理域名注册服务机构:新网数码
在配置tomcat虚拟主机时候,如何每一个虚拟主机写成单独文件,server.xml包含这些子文件? 如以下《OneinStack》中,添加JAVA环境虚拟主机后tomcat配置文件详情:
/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.landui.com-vhost SYSTEM "file:///usr/local/tomcat/conf/vhost/java.landui.com.xml">
<!ENTITY demo.landui.com-vhost SYSTEM "file:///usr/local/tomcat/conf/vhost/demo.landui.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 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"
useBodyEncodingForURI="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.landui.com-vhost;
&demo.landui.com-vhost;
</Engine>
</Service>
</Server>
注:在<server>元素前添加如下格式:
<!DOCTYPE server-xml [
<!ENTITY localhost-vhost SYSTEM "file:///usr/local/tomcat/conf/vhost/localhost.xml">
]>
并在<Engine>...</Engine]引用它(localhost-vhost,注:不能以数字开头)即可。
下面是每个单独虚拟主机文件:
/usr/local/tomcat/conf/vhost/localhost.xml
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Context path="" docBase="/data/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 "%r" %s %b" />
/usr/local/tomcat/conf/vhost/demo.landui.com.xml
<Host name="demo.landui.com" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Context path="" docBase="/data/wwwroot/demo.landui.com" debug="0" reloadable="true" crossContext="true"/>
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="demo.landui.com_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" />
/usr/local/tomcat/conf/vhost/java.landui.com.xml
<Host name="java.landui.com" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Alias>java1.landui.com</Alias>
<Context path="" docBase="/data/wwwroot/java.landui.com" debug="0" reloadable="true" crossContext="true"/>
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="java.landui.com_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" />
</Host>
售前咨询
售后咨询
备案咨询
二维码
TOP