測試過程:
系統(tǒng):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兩個(gè)域名指向本地服務(wù)器。
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個(gè)web應(yīng)用程序
這樣 D:/tomcat-6.0.16/1webapps/jforum對應(yīng)的web應(yīng)用使用http://www.hi.com訪問
這樣 E:/eclipse/ws/pm/WebContent對應(yīng)的web應(yīng)用使用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系統(tǒng)的目錄" debug="0" reloadable="true"/>
</Host>