为什么javaweb项目 域名启动 访问子页面或主页报404——Error

学向勤中得,萤窗万卷书。这篇文章主要讲述为什么javaweb项目 域名启动 访问子页面或主页报404——Error相关的知识,希望能为你提供帮助。
一、前提
【为什么javaweb项目 域名启动 访问子页面或主页报404——Error】(1)有一个服务器已经部署好项目
(2)使用IP:8080/项目名称 能够访问项目
(3)已做域名解析
二、灵魂三问:



1.tomcat是无杂物初始版本吗??




2.索引包路径对吗?




3.server.xml中配置对了吗?


< Host appBase="webapps" autoDeploy="true" name="www.xxx.com" unpackWARs="true"> 在tomcat中的conf目录中,在server.xml中的,< host/> 节点中添加:< Context path="/hello" docBase="项目包路径" debug="0" privileged="true"/>

如果以上都做了?
tomcat的web.xml(在conf目录下 一般在最后),在该文件中找到
< welcome-file-list> < welcome-file> index.html< /welcome-file> < welcome-file> index.htm< /welcome-file> < welcome-file> index.jsp< /welcome-file> < /welcome-file-list>

对比自己的主页是否和这个一样,如果不一样,请做配置,比如main.jsp。可以修改上面信息为:
< welcome-file-list> < welcome-file> main.jsp< /welcome-file> < welcome-file> index.html< /welcome-file> < welcome-file> index.htm< /welcome-file> < welcome-file> index.jsp< /welcome-file> < /welcome-file-list> > OK!重启tomcat,使用域名访问。

三、恭喜你!
为什么javaweb项目 域名启动 访问子页面或主页报404——Error

文章图片




    推荐阅读