测试过程:
系统:windowsxp
C:/WINDOWS/system32/drivers/etc/hosts文件 添加
127.0.0.1 www.hi.com
127.0.0.1 www.hello.com
这样可以测试www.hi.com,www.hello.com两个域名指向本地服务器。
1.若要使tomcat使用80端口,确保80端口可用
2.修改tomcat的 conf/server.xml
<Connector port="8080" ==> <Connector port="80"
3. <Engine name="Catalina" defaultHost="localhost">
添加<Host name="www.hi.com" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Context path="" docBase="D:/tomcat-6.0.16/1webapps/jforum" debug="0" reloadable="true"/>
</Host>
<Host name="www.hello.com" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Context path="" docBase="E:/eclipse/ws/pm/WebContent" debug="0" reloadable="true"/>
</Host>
其中D:/tomcat-6.0.16/1webapps/jforum,E:/eclipse/ws/pm/WebContent是2个web应用程序
这样 D:/tomcat-6.0.16/1webapps/jforum对应的web应用使用http://www.hi.com访问
这样 E:/eclipse/ws/pm/WebContent对应的web应用使用http://www.hello.com访问
测试通过
===============================================================================================
http://dg.lawyer.com的配置
conf/server.xml中添加:
<Host name="dg......com" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Context path="" docBase="dgpx系统的目录" debug="0" reloadable="true"/>
</Host>
本文详细介绍了如何在Tomcat服务器上配置多个域名,并将这些域名分别指向不同的本地Web应用程序。通过修改hosts文件及server.xml文件,实现了www.hi.com与www.hello.com两个域名各自对应的应用程序访问。
3055

被折叠的 条评论
为什么被折叠?



