Deploy web applications in Tomcat

Source: Internet
Author: User

I. Static deployment

All statically deployed Web applications must restart the server to take effect.

 

1. Copy the web application directory to $ catalina_home/webapps, and restart the Tomcat service.

For example, if you copy the AAA directory to $ catalina_home/webapps, you can access the Web application through http: // localhost: 8080/AAA.

2. Modify the server. xml file

For example, add a line (case sensitive)

<Context docBase = "D:/VirtualHost1" reloadable = "false" path = "/ggg"/> 

You can access the Web Application D:/virtualhost1 through http: // localhost: 8080/ggg.

3. In$CATALINA_HOMEAdd an XML file under/CONF/Catalina/localhost

For example$CATALINA_HOME/CONF/Catalina/localhost creates a test. xml file with a context element, as shown in figure

<Context docBase = "D:/VirtualHost1" reloadable = "false"/> 

You can use http: // localhost: 8080/test to access the Web application in D:/virtualhost1. Note that the context element does not have the path attribute. In this way, the server uses the. xml name as the value of the path attribute.

4. Use war files

Replace the folder in the preceding example with a war file.

To create a war file, first enter the directory of the Web application, such as D:/virtualhost1, and then execute jar cf kkk. War *.*

 

Ii. dynamic deployment

Open http: // localhost: 8080, there is a Tomcat Manager link on the left, click in, enter the user name and password (which can also be set in $ CATALINA_HOME/conf/tomcat-users.xml during installation) and dynamically deploy the web application at the bottom of the page that opens. You do not need to restart the server after deployment.

 

Reference http://www.diybl.com/course/3_program/java/javashl/200815/95846_2.html

 

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.