linux下修改tomcat默认主页

默认情况下我们输入

http://localhost:8080/是跳转到tomcat首页的,首页位置位于\webapps\ROOT下的index.html,有时候我们想输入


http://localhost:8080/直接调转到我们的某个项目的登录界面,那么要做如下两个配置文件的修改

1.修改conf/server.xml

vi server.xml  进入文本编辑

找到host节点 该节点一般位于server.xml末尾  可以使用Ctrl+f进行翻页

<Context docBase="/data/webapp/tomcat/webapps" path="" reloadable="false" debug="0">

</Context>

为防止项目中CSS,JS,JAR包引用错误.docBase只定位到项目的根目录中

docBase的是你项目放在linux系统的目录

2.修改tomcat的web.xml

web.xml 与server.xml 都在同一目录下, 可直接使用 vi web.xml 直接进行编辑

<welcome-file-list> 一般位于末尾 可以使用Ctrl+f进行翻页

在<welcome-file-list>加入你想要设置默认访问项目的login.jsp

dwsc/wx是根目录下的文件夹 与之前server.xml相结合

完整连接:/data/webapp/tomcat/webapps/dwsc/wx/login.jsp

就相当于tomcat访问你完整连接下的login.jsp

<welcome-file-list>
    <welcome-file>dwsc/wx/login.jsp</welcome-file>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
 </welcome-file-list>

猜你喜欢

转载自blog.csdn.net/s735819795/article/details/80076237