Tomcat Configuration Web virtual directory

Source: Internet
Author: User
Tags html page tomcat tomcat server

Developing a good web application that wants to be accessed by the outside world, in addition to installing a Web server, needs to map the Web application to a virtual Web directory that is accessible to the outside world, a process called Configuring the Web application virtual directory

The Tomcat server starts with version 6.0, automatically manages the web app under the WebApps directory, and uses the name of the Web App directory as the virtual directory name
Therefore, the Tomcat directory
WebApps directory, can be directly accessed by the outside world
Other directories that cannot be accessed directly by the outside world

Configure the Web App virtual directory
Under Tomcat WebApps, create a new directory Chapter02,chapter02 the name of the Web app, and then, in the Chapter02 directory, creates a welcome.html file that writes "Welcome to my Blog"

Start the Tomcat server and enter it in the browser address bar
Http://localhost:8080/chapter02/welcome.html
Visit the welcome.html page with the following results

Description, Web applications placed in the WebApps directory can be accessed directly by the outside world
If you put all your web apps in the WebApps directory, it's unreasonable, and sometimes you put web apps in other directories

Cut the Chapter02 directory into the D-Packing directory, open Internet Explorer and revisit the app, and the browser will have a 404 error

For error reasons, Tomcat cannot manage Web applications other than the <tomcat installation directory >/webapps directory
At this point, the Web app wants to be accessed by the outside world and needs to manually configure the virtual directory to configure the virtual directory on the Tomcat server in two ways
1. In the Server.xml file, configure the virtual directory
2. In the custom XML file, configure the virtual directory

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.