Several ways to deploy various projects with tomcat + nginx

Several ways to deploy various projects with tomcat + nginx

Background introduction

Now the linux basic commands and simple deployment have been basically successful.The following instructions are all deployed using tomcat + nginx

Skills list (multi-project deployment)

  1. tomcat environment variable configuration and common part modifications
  2. Deploy the zip package using tomcat + nginx.Custom Deployment Directory
  3. Deploy the war package using tomcat + nginx.Use default directory + tomcat deployment management
  4. Deploy the war package using tomcat + nginx.Custom Deployment Directory
  5. Use tomcat + nginx to deploy regular static projects.
  6. Deploy VUE \ REACT static projects such as dist.zip using nginx

Multiple tomcat environment variable configurations and common part modifications

export JAVA_HOME=/usr/local/java/jdk1.8.0_191
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
# tomcat_tomcat_manage_8080
TOMCAT_HOME=/usr/local/tomcat_manage_8080
CATALINA_HOME=/usr/local/tomcat_manage_8080
CATALINA_BASE=/usr/local/tomcat_manage_8080
export TOMCAT_HOME CATALINA_HOME CATALINA_BASE
# tomcat_tomcat_manage_8082
TOMCAT_HOME_2=/usr/local/tomcat_doctor_8082
CATALINA_HOME_2=/usr/local/tomcat_doctor_8082
CATALINA_BASE_2=/usr/local/tomcat_doctor_8082
export TOMCAT_HOME_2  CATALINA_HOME_2  CATALINA_BASE_2

# tomcat_tomcat_manage_8083
TOMCAT_HOME_3=/usr/local/tomcat_manage_8083
CATALINA_HOME_3=/usr/local/tomcat_manage_8083
CATALINA_BASE_3=/usr/local/tomcat_manage_8083
export TOMCAT_HOME_3  CATALINA_HOME_3  CATALINA_BASE_3

# tomcat_tomcat_manage_8084
TOMCAT_HOME_4=/usr/local/tomcat_static_8084
CATALINA_HOME_4=/usr/local/tomcat_static_8084
CATALINA_BASE_4=/usr/local/tomcat_static_8084
export TOMCAT_HOME_4  CATALINA_HOME_4  CATALINA_BASE_4


# tomcat_tomcat_manage_8085
TOMCAT_HOME_5=/usr/local/tomcat_patient_8085
CATALINA_HOME_5=/usr/local/tomcat_patient_8085
CATALINA_BASE_5=/usr/local/tomcat_patient_8085
export TOMCAT_HOME_5  CATALINA_HOME_5  CATALINA_BASE_5


# tomcat_gateway_8086
TOMCAT_HOME_6=/usr/local/tomcat_gateway_8086
CATALINA_HOME_6=/usr/local/tomcat_gateway_8086
CATALINA_BASE_6=/usr/local/tomcat_gateway_8086
export TOMCAT_HOME_6  CATALINA_HOME_6  CATALINA_BASE_6
# tomcat_yy_8087
TOMCAT_HOME_7=/usr/local/tomcat_customer_8087
CATALINA_HOME_7=/usr/local/tomcat_customer_8087
CATALINA_BASE_7=/usr/local/tomcat_customer_8087
export TOMACT_HOME_7  CATALINA_HOME_7  CATALINA_BASE_7
# tomcat_message_8088
TOMCAT_HOME_8=/usr/local/tomcat_attachment_8088
CATALINA_HOME_8=/usr/local/tomcat_attachment_8088
CATALINA_BASE_8=/usr/local/tomcat_attachment_8088
export TOMACT_HOME_8  CATALINA_HOME_8  CATALINA_BASE_8

The catalina.sh file under Tomcat also needs to be modified.The path is tomcat/bin/catalina.sh.The modifications are as follows:

Then modify the startup file tomcat/conf/server.xml mainly to modify two port numbers, each tomcat's port number can not conflict

Deploy the zip package using tomcat + nginx.Custom Deployment Directory

In addition to the above common parts, they need to be modified.The deployment zip package has the following special needs to be modified.

The tomcatconf\CatalinalocalhostXX.xml file needs to be modified.There are several conventions here:

  1. The xx.xml file name is the same as the uploaded zip package name.

    Other attribute configurations can refer to other instructions on Baidu.
  2. zip packages need to be decompressed on their own initiative

Deploy the war package using tomcat + nginx.Use default directory + tomcat deployment management

In addition to the above common parts, they need to be modified.Deploying a war package has the following special needs to be modified.

  1. If you do not need to customize the store directory.Then the jar package can be uploaded directly to
    /usr/local/taotao-manager-web/webapps
  2. On startup, tomcat automatically adds/taotao-manager-web to the configuration context root as the name of the war package when requested
  3. Store in the default directory and consider using the deployment management page that comes with tomcat.This enables hot deployment of war packages over the external network.
    3.1 Modify/usr/local/taotao-manager-web/conf/tomcat-users.xml where new pictures are added.For account password.

    3.2 Logon Administration Page
    http://ip:8080/manager/html

    3.3 Modify/usr/local/taotao-manager-web/webapps/manager/WEB-INF/web.xml settings to allow packet size to be uploaded
Thirty-two original articles were published. Eighty-eight were praised. Ten thousand visits+
Private letter follow

Keywords: Tomcat Nginx xml Java

Added by kataras on Tue, 14 Jan 2020 03:36:06 +0200