`
lionelf
  • 浏览: 81429 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

windows下tomcat 发布多个web项目(多个域名,同一ip)

阅读更多

公司有个项目,需要在同一个Tomcat服务器上,部署多个应用, 这样,就是一个IP地址对应不同的web项目。


在tomcat的conf目录修改server.xml配置域名和项目的挂接关系 可以注释掉默认<host></host>

使用实际用到的配置路径:

<Host name=" www.google.cn " debug="0" appBase="webapps"
         unpackWARs="true"  xmlValidation="false" xmlNamespaceAware="false">
         <Context path="" docBase="D:\Tomcat5\webapps\host1"  reloadable="true"   caseSensitive="false"   debug="0"></Context>
  </Host>

  <Host name=" www.youku.com " debug="0" appBase="webapps"
  unpackWARs="true" xmlValidation="false" xmlNamespaceAware="false">  
        <Context path="" docBase="D:\Tomcat5\webapps\host2" reloadable="true"   caseSensitive="false"   debug="0"></Context>
 </Host>

          其中:Host 的name属性为你的域名、appBase指向你的工程文件所在的目录、docBase指向你的工程目录,其他属性可根据自己实际情况及需要配置。

          不配置 <Context path="" docBase="D:\Tomcat5\webapps\host1"  reloadable="true"   caseSensitive="false"   debug="0"></Context> 的话,tomcat会将 \webapps\ROOT 作为docBase的路径。

            配置完成后到检查web.xml检查是否有:

"<welcome-file-list id="WelcomeFileList">
  <welcome-file>index.html</welcome-file>
  <welcome-file>index.jsp</welcome-file>
 </welcome-file-list>"

然后到docBase指定的目录下增加index.html文件,内容是:

<%@ page contentType="text/html; charset=GBK" %>

<script type="text/javascript">

window.location.href="/ecdomain/framework/qhdwmn/index.jsp";
</script>

保存后重启tomcat即可。

分享到:
评论
1 楼 honeyweishu 2011-09-18  
我配置了也是这样,但是还是比起作用,我是在本地测试的,可不可以帮我解决一下,谢谢,我Q312380572

相关推荐

Global site tag (gtag.js) - Google Analytics