測試過程:
系統: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>