<Hostname="" 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="" 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-listid="WelcomeFileList"><welcome-file>index.html</welcome-file><welcome-file>index.jsp</welcome-file></welcome-file-list>"
然后到docBase指定的目录下增加index.html文件,内容是:
<%@ pagecontentType="text/html; charset=GBK" %>
<scripttype="text/javascript">
window.location.href="/ecdomain/framework/qhdwmn/index.jsp";</script>
保存后重启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,搞定~