Tomcat server Learning 1: tomcat server Learning

Source: Internet
Author: User

Tomcat server Learning 1: tomcat server Learning

1. server port configuration

1. All tomcat configuration files are in the conf folder.

2. How to modify the server port:

File: server. xml

    

3. tomcat server default port: 8080, changed to 80 for direct access in the browser without adding a port number

 

 

Ii. tomcat virtual directory ing

After a web application is developed, if you want to provide external access, you must hand over the directory where the web application is located to the web Service Manager for management. This process is called the ing of virtual directories.

The

Add <Context path = "/JavaWebApp" docBase = "F: \ JavaWebDemoProject "/> to map the JavaWebDemoProject Java Web application under drive F to the JavaWebApp virtual directory. The JavaWebApp virtual directory is composed

Managed by the Tomcat server, JavaWebApp is a directory that does not exist on the hard disk. It is a directory that we can write at will, that is, a virtual directory. The Code is as follows:

      

 

Context represents a web application with two elements

      • Path: a virtual web directory, which must start "/"
      • DocBase: directory of the web application.

Use a browser to access the web Resource 1. jsp under the virtual directory "/JavaWebApp". The access result is as follows:

Note that this method is no longer recommended after tomcat6.0. The reason is that the tomcat server must be restarted every time you modify server. xml.

2. virtual directory ing method 2: Allow tomcat to automatically Map

Tomcat automatically manages all web applications under the webapps folder and maps it to a virtual directory. In other words, all web applications under the tomcat service webapps can be directly accessed from outside.

      

      

3. virtual directory ing method 3

Add an xml extension file, such as aa. xml, to the \ conf \ Catalina \ localhost directory of the tomcat server.

      

Add the following content to the aa. xml file:ContextMap elements to Java Web applications. The Code is as follows:

      

Note: The virtual ing directory is the xml name.

      

The advantage of using this method is to modify the configuration file without restarting tomcat.

 

 

      Statement: javaweb learning is organized by a lone wolf blogger. Thank you very much.

      

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.