tomcat7部署多个web应用不同编码,端口

Posted V青山绿水

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了tomcat7部署多个web应用不同编码,端口相关的知识,希望对你有一定的参考价值。

1个tomcat部署多个web应用可以设置不同编码,端口,server.xml配置如下:

 

<?xml version=‘1.0‘ encoding=‘utf-8‘?>
<Server port="8014" shutdown="SHUTDOWN">  
   <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
  <Listener className="org.apache.catalina.core.JasperListener" />
  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />


  <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="9091" protocol="HTTP/1.1"
               connectionTimeout="60000" maxThreads="450" redirectPort="8443" URIEncoding="UTF-8"/>
    
    <Connector port="18014" protocol="AJP/1.3" redirectPort="8443" />

    <Engine name="Catalina" defaultHost="localhost">

     <Realm className="org.apache.catalina.realm.LockOutRealm">
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>
      </Realm>
        
     <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">      
            <Context path="" docBase="D:\cjktest\tomcat71\webapps\cgplatform" reloadable="true" />
      </Host>
    </Engine>
  </Service>

  <Service name="Catalina1">

    <Connector port="9092" protocol="HTTP/1.1"
               connectionTimeout="60000" maxThreads="450" redirectPort="8443" URIEncoding="UTF-8"/>
    
    <Connector port="28014" protocol="AJP/1.3" redirectPort="8443" />

    <Engine name="Catalina" defaultHost="localhost">

      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>
      </Realm>
        
      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">      
            <Context path="" docBase="D:\cjktest\tomcat71\webapps\cgcoms" reloadable="true" />
      </Host>

 

<!--

      <Host name="passport.caibab.com"  appBase="/home/software/tomcat_cas"
            unpackWARs="true" autoDeploy="true">            
            <Context path="" docBase="/home/software/tomcat_cas/webapps/cgcas" reloadable="true" />
      </Host>

-->
    </Engine>
  </Service>
  
</Server>

以上是关于tomcat7部署多个web应用不同编码,端口的主要内容,如果未能解决你的问题,请参考以下文章

Tomcat多站点部署方式

分端口部署web项目

Tomcat 7(虚拟主机?)

运行多个 tomcat 服务器

同一服务器部署多个Tomcat时端口修改

Tomcat7多网站多端口