1.首先在server.xml中添加HOST
<Host name="www.snowing.com" appBase="/Users/snowing/Downloads/snowing">
<Context path="" docBase="/Users/snowing/Downloads/snowing/1"/>
</Host>
2.在/Users/snowing/Downloads/snowing目录下创建web项目
项目中放好页面
3.sudo vi /etc/Hosts输入终端,修改Host中的配置
这里的10.1.227.69,是我电脑的ip
显示如下:把红色加进去
localhost:bin snowing$ sudo vi /etc/Hosts
Password:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##exx
127.0.0.1 localhost
10.1.227.69 www.snowing.com
255.255.255.255 broadcasthost
::1 localhost
~
~
"/etc/Hosts" 10L, 255C
:wq(退出终端)
3.重新启动tomcat
访问www.snowing.com:8080