web tomcat配置多个host实例

来源:互联网 发布:淘宝专业版和智能版 编辑:程序博客网 时间:2024/05/17 04:17
tomcat server.xml配置如下
<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">         <Context docBase="LuceneAjax" path="/LuceneAjax" reloadable="true"                 source="org.eclipse.jst.j2ee.server:LuceneAjax"/></Host>      <Host appBase="tempapp" autoDeploy="true" name="yourdomain" unpackWARs="true">           <Context docBase="d://yourdir" path="/dir" reloadable="true"                 source="org.eclipse.jst.j2ee.server:LuceneAjax"/> </Host>  


其中appBase是web项目所在的目录 name是域名 它不是随便取的 应该在host文件中配置才能用 或者用你的机器名

打开C:/WINDOWS/system32/drivers/etc/hosts文件,在其中增加
127.0.0.1       yourdomain

访问时:http://yourdomain:port/dir/filename






0 0
原创粉丝点击