Tomcat deployment project (3 ways)

Tomcat deployment project


This section describes how to deploy services on Tomcat.

Tomcat directory structure

  • bin: Tomcat startup and shutdown scripts.
  • conf: Tomcat configuration file.
  • lib: Class library (jar package) required by Tomcat.
  • logs: log directory.
  • temp: Temporary files generated when Tomcat is running.
  • webapps: The directory where web applications are stored.
  • work: Store Servlet source files generated by Tomcat.

Deployment method

1. Copy the web project files directly to the webapps directory

This is the most common way.

The webapps directory is Tomcat's default application directory. When the server starts, all applications in this directory will be loaded. If you want to modify this default directory, you can modify the appBase value in the Host tag in the server.xml file under conf.

This method is actually the same as deploying the project in the IDE development environment.

The access path using this method is: http://localhost:8080/webname.

2. Modify the Server.xml file

Find the Host tag in the server.xml file under conf and add the following code in it:

<Context path="/项目名" docBase="项目路径"  reloadable ="true" debug="0" privileged="true"></Context> 
  • path: indicates the access path, which can be customized, for example: http://localhost:8080/budaye.
  • docBase: Represents the path of the application. You can use an absolute path or a relative path. The relative path is relative to webapps.
  • reloadable: indicates that the class package can be automatically loaded in the classes and lib folders during runtime. This property is usually set to true in the development phase to facilitate development; it should be set to false in the release phase to improve the access speed of the application.

3. Add the xml configuration file in the conf\Catalina\localhost directory

The file content configuration is as follows:

<Context path="/项目名" docBase="项目路径"  reloadable ="true" debug="0" privileged="true"></Context> 

The path attribute can be removed in the configuration, because the root path when accessing the project only depends on the name of the XML file. As in the above example, the address for accessing the application is as follows: http://localhost:8080/project name.


PS: For more more content..., please check --> "Server Development"
PS: More more content..., please check --> "Server Development"
PS: More more content..., please check --> "Server Development"

Guess you like

Origin blog.csdn.net/u011578734/article/details/112851672