未名Q

此生若能得幸福安稳,谁又愿颠沛流离。

  :: 首页 :: 博问 :: 闪存 :: 新随笔 :: :: 订阅 订阅 :: 管理 ::

conf/server.xml

移除注释内容后,类似内容如下:

<Server>
  ……
  ……
  ……
  <Service name="Catalina">
    <Connector port="8080" 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>
</Server>

 

多个虚拟主机的配置,即增加 <service> 或 <host> 标签段。

 

一、端口方式:<Service>

</Service></Server>之间增加

      </Host>
    </Engine>
  </Service>
  
  <!-- 虚拟主机:端口方式  须修改三个地方: Service name / Connetor port / Host appBase
        appBase可为相对路径,也可为绝对路径
--> <Service name="Catalina2"> <Connector port="6038" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="6444" /> <Connector port="6010" protocol="AJP/1.3" redirectPort="6444" /> <Engine name="Catalina" defaultHost="localhost"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> <Host name="localhost" appBase="webapps2" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> </Host> </Engine> </Service> </Server>

http://localhost:8080/

http://locathost:6037/

 

二、域名方式:<Host>

 在</Host></Engine>之间增加

      </Host>
      <!--虚拟主机:域名方式,需修改 Host name/appBase
      -->
      <Host name="a.b.c"  appBase="webapps2"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
      </Host>
    </Engine>
  </Service>
</Server>

http://locathost:8080/

http://a.b.c:8080/

posted on 2018-11-06 16:46  未名Q  阅读(246)  评论(0编辑  收藏  举报