当前位置:web 服务器 > Tomcat >>

tomcat多个端口对应多个web应用

 代码如下 复制代码

<?xml version='1.0' encoding='utf-8'?>

<Server port="8005" shutdown="SHUTDOWN">

    <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="7777" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
    <Engine name="Catalina" defaultHost="localhost">
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase"/>
      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
      </Host>
    </Engine>
  </Service>
 
   <Service name="Catalina2">
    <Connector port="8002" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8444"/>
    <Connector port="8010" protocol="AJP/1.3" redirectPort="8444" URIEncoding="UTF-8" />

    <Engine name="Catalina2" defaultHost="localhost">
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase"/>
      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
            <Context path=""  docBase="system" />
            
      </Host>
    </Engine>
  </Service>

</Server>

重新复制一个service,改掉名字,端口,如上,测试成功。

还有一点需要数以的是:<Context path="" docBase="system" />

path不填就可以实现直接打入网址和端口就可以进入system引用啦。

补充:Jsp教程,J2EE/EJB/服务器
Apache
IIS
Nginx
Tomcat
如果你遇到web 服务器难题:
访问www.zzzyk.com 试试
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,