How to deploy multiple tomcats and projects on one server (the most detailed graphic tutorials!!!)

Preface

Tip: There are multiple ways to deploy a variety of projects, recited herein are in Windows to install multiple tomcat by modifying the port to deploy the project, Linux deployment or less the same


# First step: After decompressing the tomcat installation package, copy and rename it ; if you have multiple tomcats, copy an extra copy. Students who don’t have tomcat can download the one provided in this article

Link: https://pan.baidu.com/s/1DTHCoU_ZnEZht0t-z3OcSg
extraction code: 5236
as shown: Insert picture description here)

Second, the construction steps

1. The tomcat service must rely on jdk to run, so you must first install jdk and configure environment variables. If you don’t have a good configuration, please refer to the article linked below

Reprinted: https://www.cnblogs.com/boringwind/p/8001300.html

2. Configure tomcat environment variables

  1. I don't think I need to say where the environment variables are matched. If the environment variables of the JDK are not matched, tomcat cannot be started. Create an environment variable directly under system variables:
    variable name : CATALINA_HOME
    variable value : tomcat installation directory
    Insert picture description here

  2. CATALINA_HOME is allocated as many tomcats as there are, and appended at the end
    For example: CATALINA_HOME_8081, CATALINA_HOME_8082
    Insert picture description here

  3. Create a new environment variable under system variables: the same configuration as CATALINA_HOME, configure as many tomcats as you need, just append CATALINA_BASE_8081
    variable name : CATALINA_BASE
    variable value : tomcat installation directory
    Insert picture description here
    Insert picture description here

  4. Create a new environment in path , and add two variables to each tomcat as shown in the figure:
    New variable 1: %CATALINA_HOME%\lib
    New variable 2: %CATALINA_HOME%\bin
    Insert picture description here

3. Perform tomcat file configuration

  1. The default port for tomcat installation is 8080 , so the first tomcat does not need to be configured, only the remaining two tomcats need to be modified. There are three tomcats as shown in the figure, and only tomcat_8081 and tomcat_8082 need to be modified.
    Insert picture description here

  2. Modify the server.xml under the tomcat_8081 directory config as shown in the figure: Remember to save after modification
    Insert picture description here
    Insert picture description here
    Insert picture description here

  3. Modify the startup.bat under the bin of tomcat_8081 directory, select CATALINA_HOME and hold down the shortcut key: Ctrl+H, replace all the values ​​of your environment variables with one key and save as shown in the figure: Remember to save after modificationInsert picture description here
    Insert picture description here

  4. Modify catalina.bat under the bin of tomcat_8081 directory. The first step is to select CATALINA_HOME and hold down the shortcut key: Ctrl+H, one key replaces all with the values ​​of your environment variables. The second step is to select CATALINA_BASE and hold down the shortcut key: Ctrl+H, one key all Replace with the value of your environment variable as shown in the figure: remember to save after modification



    Insert picture description here
    Insert picture description here
    Insert picture description here

4. Configure the tomcat file so that a tomcat is configured. If you have several tomcats, repeat the above steps in each tomcat. Each configuration is similar to the above tomcat_8081. You only need to modify the port and the corresponding tomcat environment. variable

Three, start tomcat

  1. Mode: Directly enter the directory mode.
    Enter the bin directory of tomcat and open cmd: enter startup.bat and press enter, enter in the browser: http://localhost:8081/
    Insert picture description hereInsert picture description here

  2. Let's open a default 8080 port server to test it, enter the unmodified tomcat bin directory,
    enter startup.bat and press Enter, enter in the browser: http://localhost:8080/
    Insert picture description hereInsert picture description here as shown in the picture: start as shown Success, because the project was deployed on the local port 8080, the default tomcat webpage was overwritten. There is also a tomcat_8082 that will not be demonstrated here. Students who want to deploy multiple tomcats can deploy according to the above steps.


to sum up

Tip: To deploy multiple projects, you can modify the port with just one tomcat. This article records that multiple tomcats are installed and started on one server. Projects or multiple projects can be deployed in each tomcat, which is a more stable and high-performance method .

Finally: The copyright of this article belongs to the author and (CSDN), but the above statement must be retained and placed in an obvious place on the article page without the author's consent. Thank you for your cooperation!!!

Guess you like

Origin blog.csdn.net/weixin_46551668/article/details/114917438