Posted on 2015-05-27 11:02
龙旋风 阅读(596)
评论(0) 编辑 收藏
背景:在本地环境配置,不同域名访问对应的数据:
1、硬件配置:Win7、Tomcat7.0;
2、修改 C:\Windows\System32\drivers\etc\hosts 文件
增加域名映射本服务器地址(可换成IP地址):
127.0.0.1 heyj.net
127.0.0.1 www.test.net
127.0.0.1 www.run.net
3、
tomcat目录下的conf文件夹, server.xml
修改8080端口,改为80
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
<Connector connectionTimeout="20000" port="80" protocol="HTTP/1.1" redirectPort="8443"/>
修改Host端口对应的配置
<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
<Alias>heyj.net</Alias>
<Alias>www.test.net</Alias>
<Alias>www.run.net</Alias>
</Host>
4、输入localhost、heyj.net、www.test.net、www.run.net后,IE页面均能显示如图所示:


