zoukankan      html  css  js  c++  java
  • Tomcat中配置多个网站,多个站点的方法

    最近想要在tomcat中部署多个网站,但是不知道怎么配置,通过查找资料和摸索,发现要实现这一点其实还是很简单的。

    如何利用Tomcat建立多个Web应用 呢?

    重点就是:server.xml文件的配置

    找到server.xml配置文件中的<Host>节点,通过增加host,来配置多个站点。

    配置站点1

    <Host name="www.shishangshow.top"  appBase="webapps"
                unpackWARs="true" autoDeploy="true">
    		<Context  path=""  docBase="C:yxy	omcatwebappsshishangshow" reloadable="true" >
                         
             </Context>
                <!-- SingleSignOn valve, share authentication between web applications
                 Documentation at: /docs/config/valve.html -->
            <!--
            <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
            -->
    
            <!-- Access log processes all example.
                 Documentation at: /docs/config/valve.html
                 Note: The pattern used is equivalent to using pattern="common" -->
            <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" />
    </Host>

    配置站点2

    <Host name="www.yangxianyang.top"  appBase="webapps"
                unpackWARs="true" autoDeploy="true">
    		<Context  path=""  docBase="C:yxy	omcatwebappsyangxianyang" reloadable="true" >
                         
            </Context>
                <!-- SingleSignOn valve, share authentication between web applications
                 Documentation at: /docs/config/valve.html -->
            <!--
            <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
            -->
    
            <!-- Access log processes all example.
                 Documentation at: /docs/config/valve.html
                 Note: The pattern used is equivalent to using pattern="common" -->
            <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" />
    </Host>

    配置站点3

    <Host name="www.albertyy.com"  appBase="webapps"
                unpackWARs="true" autoDeploy="true">
    		<Context  path=""  docBase="C:yxy	omcatwebappsyangxianyang" reloadable="true" >
                         
            </Context>
                <!-- SingleSignOn valve, share authentication between web applications
                 Documentation at: /docs/config/valve.html -->
            <!--
            <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
            -->
    
            <!-- Access log processes all example.
                 Documentation at: /docs/config/valve.html
                 Note: The pattern used is equivalent to using pattern="common" -->
            <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" />
    </Host>

    就这样通过增加host就能配置多个站点了,还是挺简单。

  • 相关阅读:
    华为超级应用联合创新计划启动,共同打造极致用户体验
    华为P20无敌拍摄能力开放 如何即刻获得?
    两千万次服务的背后,华为终端开放实验室到底做了什么?
    HUAWEI HiAI亮相华为开发者生态大会 助力应用AI开发实现加速度
    搜狐新闻APP是如何使用HUAWEI DevEco IDE快速集成HUAWEI HiAI Engine
    旅行助手:重新定义旅行
    世界更清晰,搜狐新闻客户端集成HUAWEI HiAI 亮相荣耀Play发布会!
    Android和设置alpha(图像)透明度
    Android应用开发欢迎界面不想显示最上面的LOGO
    聊天页面输入框和发送按钮的布局问题 Android
  • 原文地址:https://www.cnblogs.com/yangxianyang/p/13675646.html
Copyright © 2011-2022 走看看