Tomcat configuration and virtual path Configuration

Source: Internet
Author: User

I. Green version of tomcat 5.5.20

The first sentence does not contain quotation marks.

Set CATALINA_HOME = C: \ Program Files \ Apache Software Foundation \ apache-tomcat-5.5.20

Second sentence

Call "C: \ Program Files \ Apache Software Foundation \ apache-tomcat-5.5.20 \ bin \ service. bat" install tomcat5

Run the following two statements in dos:

OK

Ii. tomcat virtual path Configuration

After tomcat is installed, you only need to copy your web project to % atat_home % webapp !! In fact, there is another way to set the virtual directory, that is, to map the project directory to tomcat. In this way, repeated deployment is not required, saving time and convenience for developers.
The method is as follows:
1. Find % TOMCAT_HOME % \ conf \ server. open the xml file (that is, the related files under the tomcat installation directory) and add the following code between (Note the case sensitivity of letters !!!)

DocBase is the actual path. Here we usually write an absolute disk path. Of course, we can also write a relative path, which is relative to the webapps directory in the tomcat installation directory, generally, the virtual directory is set to separate the installation of tomcat from the project. Therefore, we recommend that you use the absolute disk path, which is in the tomcat installation directory from time to time.
The path is a virtual path and the access path. Note: "/" must be added.
We recommend that you set debug to 0 and reloadable to true.

2. test and restart the tomcat server, and enter http: // localhost: 8080/test in the browser.
3. If a 404 error occurs during the test, if the preceding configuration is correct, it may be in % atat_home % \ conf \ web. the directory displayed in the virtual path is disabled in the xml file. in the xml file, find

Code

<Servlet> <servlet-name> default </servlet-name> <servlet-class> org. apache. catalina. servlets. defaultServlet </servlet-class> <init-param> <param-name> debug </param-name> <param-value> 0 </param-value> </init- param> <init-param> <param-name> listings </param-name> <param-value> false </param-value> </init-param> <load- on-startup> 1 </load-on-startup> </servlet>

 

Change the value of listings to true and restart tomcat. The test is successful after the url is entered!

4. If the project development is complete and you are ready to deploy it on the server, remember to put the web in step 3. change the value of the listings parameter in the xml file to false, so that the deployment path of the project cannot be displayed to the user!
The details are as follows:

 

<Init-param> <param-name> listings </param-name> <param-value> false </param-value> </init-param>

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.