Three ways to deploy Web apps to virtual hosts

Source: Internet
Author: User

Way One:
Inside the <Host> tag under the <Engine> tab in the Tomcat]/conf/server.xml file, add a


<context path= "/news1" docbase= "E:\web\news1"/>

--><context path= "" docbase= "E:\web\news1"/> default access to Web direct localhost/html files

--If you need to access the virtual host (site) directly through http://localhost, you will need to find the Web-inf/web.xml under the current Web application and add the following configuration under the Root tab:

      <welcome-file-list>
<welcome-file> 1.html (page that needs to be set as homepage) </welcome-file>

<welcome-file> 2.html (if the page above does not exist then this page will be set to the homepage) </welcome-file>
</welcome-file-list>


One of the context represents a Web application


Docbase used to point to the real path of the web App


Path is used to point to the virtual path of the Web App.

If you want to represent a multilevel path, you can refer to the following configuration: Path= "/NEWS1/A/B/C"

This method is not recommended, because each configuration will need to restart the server before it can play a role!

Way Two
In the [tomcat]/conf/catalina/[host]/directory, add a xx.xml file, the contents of the file are as follows:


<context docbase= "E:\web\news2"/>


Where the file name is the virtual path to the Web app's external access (if you need to set it to default access, change the file name directly to root --it must be the root of the capitalization)

--If you need to access the virtual host (site) directly through http://localhost, you will need to find the Web-inf/web.xml under the current Web application and add the following configuration under the Root tab:

      <welcome-file-list>
<welcome-file> 1.html (page that needs to be set as homepage) </welcome-file>

<welcome-file> 2.html (if the page above does not exist then this page will be set to the homepage) </welcome-file>
</welcome-file-list>


Docbase used to point to the real path of the web App

If you want to represent a multilevel path, you can replace the slash with # in the file name
such as: News2#a#b#c.xml

This method does not need to restart the server can play a role!

Mode three
During the configuration of the virtual host, you can configure the default managed directory for the virtual host, and you can deploy the Web app directly to the Web app's default managed directory !

The name of the folder is the virtual path to the Web app's external access (if you need to set it to default access, change the folder name to root--it must be the capitalization root)

--If you need to access the virtual host (site) directly through http://localhost, you will need to find the Web-inf/web.xml under the current Web application and add the following configuration under the Root tab:

      <welcome-file-list>
<welcome-file> 1.html (page that needs to be set as homepage) </welcome-file>

<welcome-file> 2.html (if the page above does not exist then this page will be set to the homepage) </welcome-file>
</welcome-file-list>



This method does not need to restart the server can play a role!

Three ways to deploy Web apps to virtual hosts

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.