Tomcat Learning-TOMCAT7 Modify/webapps/root Publishing Path (Linux and Windows environment)

Source: Internet
Author: User

One of the containers that is often used in web development is tomcat, where most people develop a Windows environment, and when the project really travels, it is on a Linux server. The following is a brief explanation of the publishing path for modifying Tomcat deployment applications on Linux servers.
Now the application server is using a lot of notes or TOMCAT7, take Tomcat for example. TOMCAT7, like previous versions, the default publisher is under $tomcat/webapp/root, which is when we start Tomcat through http://localhost:80880 to access the default Tomcat Welcome page. So what do we do if we want Tomcat to access our own custom path?
Here are three ways to:
(1): Delete all files in/root directory
①: This is the easiest way to delete all the files directly below/root, and put your compiled works into a modified directory.
②: Modify the/conf/server.xml file, in the inside ... Add the following code to start Tomcat

<context path= "" docbase= "$Tomcat/webapps/root"/>

Note: The purpose of deploying the application to the Tomcat root is to access the application directly through "Http://[ip]:[port". ($Tomcat, the directory full path, this configuration is actually can be omitted, but for the standard or configuration is good)
(2): Delete all the files in the/root directory and create a new project name (project name)
①: This approach is a little more complicated than the first, putting the projects you need to deploy into a new folder. Example: (I created a new MyApp to store my own items, the directory for/toot/myapp)
②: Modify the/conf/server.xml file, in the inside ... Add the following code to start Tomcat

<context path= "" docbase= "MyApp"/>

Note: Use the "http://[ip]:[port]/[appname]" context path for access. This configuration can not be omitted at this time, must add.
(3): Delete/root directory, under WebApp New project name (project name)
①: Create a new project name (project name) directly under WebApp, example: Directory/webapp/myapp.
②: Modify the/conf/server.xml file, in the inside ... Add the following code to start Tomcat.

<context path= "" docbase= ""/>

Note: Use the "http://[ip]:[port]/[appname]" context path for access. This configuration can not be omitted at this time, must add.

The following is a related explanation:

 
<context path= "/test/rest" docbase= "/project/applications/rest" debug= "0" reloadable= "false" crossContext= "true" ></Context> path

indicates your Access path
docbase points out that your storage path
, debug, provides the least information for setting debug level 0, and 9 provides the most information
reloadable =true is automatically reloaded when Web.xml or class changes. No need to restart service
crosscontext= "True" to indicate configuration different context share a session

Note: This inside name indicates access to the local localhost address, appbase indicates the parent location specified by the project, path is the name of the virtual directory, and if you want to display the home page with just the IP address, the key value is left blank; Docbase is the path to the virtual directory. It defaults to the $tomcat/webapps/root directory!

Reference:
1: Methods to deploy the application to the Tomcat root directory
2: Modify the/webapps/root release path for TOMCAT7

Related Article

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.