如何将tomcat默认页面换成项目首页?
原创
©著作权归作者所有:来自51CTO博客作者CorwinPC的原创作品,请联系作者获取转载授权,否则将追究法律责任
问题分析
安装好tomcat以后,我们输入网址(或者ip),访问到tomcat(默认端口为8080),浏览器当中出现的是tomcat的欢迎界面,如下:

那么如何能够输入地址以后能够访问到我们自己发布的默认欢迎界面呢?方法如下:
1.首先找到tomcat的目录的conf文件夹

2.找到server.xml,打开并编辑

3.找到文件中的Host节点
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<Context crossContext="true" docBase="项目地址路径" path="" reloadable="true" />
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>
4.将tomcat的默认端口8080改为80

5.确保项目中的web.xml中有如下代码
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
修改之后,本机可以通过 localhost进行访问项目,服务器上,可以通过域名访问项目

到这里,顺利的解决了tomcat首页映射问题,勤记录,懂分享。