windows下tomcat 發佈多個web項目(多個域名,同一ip)
<Hostname="www.google.cn"
"<welcome-file-listid="WelcomeFileList">
然後到docBase指定的目錄下增加index.html文件,內容是:
<%@ pagecontentType="text/html; charset=GBK" %>
<scripttype="text/javascript">
window.location.href="/ecdomain/framework/qhdwmn/index.jsp";
</script>
保存後重啓tomcat即可。
********************************************************
另一個大神說的:
windows下Tomcat多域名
1. 修改host下,接收要設置的域名:
進入C:\WINDOWS\system32\drivers\etc,先取消host文件的只讀屬性。然後添加一句:
127.0.0.1 docviewer.com.cn
所以配置完之後的host可能如下:
127.0.0.1 localhost
127.0.0.1 docviewer.com.cn
2. 修改tomcat的server.xml,增加host一段,可以參考server.xml中原來配置的localhost。例如:
<Hostname="docviewer.com.cn"appBase="webapps_docviewer"unpackWARs="true"autoDeploy="true"xmlValidation="false"xmlNamespaceAware="false">
<Contextpath=""reloadable="true"docBase="F:\docviewer\public"/>
</Host>
<Hostname="www.docviewer.com.cn"appBase="webapps_docviewer"unpackWARs="true"autoDeploy="true"xmlValidation="false"xmlNamespaceAware="false">
<Contextpath=""reloadable="true"docBase="F:\docviewer\public"/>
</Host>
OK,搞定~