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.