zoukankan      html  css  js  c++  java
  • Tomcat中更改网站根目录和默认页的配置方法

    1.tomcat原来的默认根目录是http://localhost:8080,如果想修改访问的根目录,可以这样:

    找到tomcat的server.xml(在conf目录下),找到:

    <Host name="localhost" appBase="webapps"
           unpackWARs="true" autoDeploy="true"
           xmlValidation="false" xmlNamespaceAware="false"></Host>



    在</Host>前插入:

    <Context path="" docBase="D:/eclipse3.3/jb51.net/tomcat/" debug="0"/>

    其中D:/eclipse3.3/jb51.net/tomcat/就是我想设置的网站根目录,然后重启tomcat。


    再次访问http://localhost:8080时,就是直接访问D:/eclipse3.3/jb51.net/tomcat/目录下的文件了。


    2.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>

    这是tomcat默认的3个文件,当你输入指定路径后,tomcat会自动查找这3个页面。如果你想让tomcat自动找到自己的页面,比如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>

    这样就可以了。

  • 相关阅读:
    线程同步的几种实现方案
    关于java中三种初始化块的执行顺序
    java数组
    Codeblocks 17汉化
    聚焦天狗
    linux下搭建svn添加多个仓库(项目)
    使用Python在windows环境下获取Linux服务器的磁盘、内存等信息
    python smtplib使用163发送邮件 报错 554 DT:SPM
    防抖与节流
    js
  • 原文地址:https://www.cnblogs.com/chen-lhx/p/4438565.html
Copyright © 2011-2022 走看看