Change the site root directory in Tomcat

Source: Internet
Author: User

Original http://www.codesec.net/view/401617.html

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:

Copy the code code as follows:

Unpackwars= "true" autodeploy= "true"
Xmlvalidation= "false" Xmlnamespaceaware= "false" ></Host>
Insert before </Host>:

Copy the code code as follows:

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

Copy the code code as follows:

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

Copy the code code as follows:

<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 site root directory 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.