=================================******************************************=====================================
1.D:\dev\tomcat6\conf\server.xml 下修改
(1).原始代码:
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
修改后代码:
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
只是把port=8080,修改成port=80就可以了,其他的参数不变
(2).单个域名绑定:
原始代码:
<Engine name="Catalina" defaultHost="localhost">
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false" />
</Engine>
当然这里我把注释代码统统删除掉了,省的碍眼
修改后:
<Host name="chengqun.202.71one.com" debug="0" appBase="d:\wwwroot\chengqun"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="/" docBase="d:\wwwroot\chengqun"></Context>
</Host>
<Host name="chengqun1.202.71one.com" debug="0" appBase="d:\wwwroot\chengqun1"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="/" docBase="d:\wwwroot\chengqun1"></Context>
</Host>
原始代码:
<Engine name="Catalina" defaultHost="localhost">
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false" />
</Engine>
当然这里我把注释代码统统删除掉了,省的碍眼
修改后:
<Host name="chengqun.202.71one.com" debug="0" appBase="d:\wwwroot\chengqun"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="/" docBase="d:\wwwroot\chengqun"></Context>
</Host>
<Host name="chengqun1.202.71one.com" debug="0" appBase="d:\wwwroot\chengqun1"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="/" docBase="d:\wwwroot\chengqun1"></Context>
</Host>
多域名绑定:
<Host name="chengqun.202.71one.com" debug="0" appBase="d:\wwwroot\chengqun"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Alias>chengqun.202.71one.com</Alias>
<Alias>chengqun1.202.71one.com</Alias>
<Alias>chengqun2.202.71one.com</Alias>
<Context path="/" docBase="d:\wwwroot\chengqun"></Context>
</Host>
<Host name="chengqun.202.71one.com" debug="0" appBase="d:\wwwroot\chengqun"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Alias>chengqun.202.71one.com</Alias>
<Alias>chengqun1.202.71one.com</Alias>
<Alias>chengqun2.202.71one.com</Alias>
<Context path="/" docBase="d:\wwwroot\chengqun"></Context>
</Host>
这里面的参数还有很多,我也不是很清楚,不过这样做确实可以实现多域名绑定哈哈.而且网站页面修改了只要直接覆盖就可以了,tomcat可以自动更新类和页面,当然如果修改了web.xml或lib,则需要重启tomcat才可以.
2.C:\WINDOWS\system32\drivers\etc\HOSTS
127.0.0.1 chengqun.202.71one.com
3.手动在tomcat\webapps\目录下创建对应的项目文件夹,将项目的WebRoot文件夹拖进去
4.启动tomcat,在地址栏访问chengqun.202.71one.com 对应的项目内容能出来就OK了。