Change the configuration method for the site root and default page in Tomcat

Source: Internet
Author: User

1.tomcat the original default root directory is http://localhost:8080, if you want to modify the root directory of access, you can:

Locate the Tomcat Server.xml (under the Conf directory) and find:

<name= "localhost"  appBase= "WebApps"       Unpackwars  = "true"  autodeploy= "true"       xmlvalidation= "false" Xmlnamespaceaware = "false" ></ Host >



Insert before </Host>:

<path= ""  docBase= "d:/eclipse3.3/jb51.net/tomcat/"  Debug  = "0"/>

Where d:/eclipse3.3/jb51.net/tomcat/is the Web root directory that I want to set up, and then reboot Tomcat.


When you visit http://localhost:8080 again, you are directly accessing the files in the d:/eclipse3.3/jb51.net/tomcat/directory.


2.tomcat Web. XML (in the Conf directory), found in the file

<welcome-file-list>        <Welcome-file>Index.html</Welcome-file>        <Welcome-file>Index.htm</Welcome-file>        <Welcome-file>index.jsp</Welcome-file>    </welcome-file-list>

This is the default 3 files for Tomcat, and when you enter a specified path, Tomcat will automatically find the 3 pages. If you want Tomcat to automatically find its own page, such as main.jsp. The above information can be modified to:

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

That's all you can do.

Change the configuration method for the site root and default page in Tomcat

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.