Tomcat service seven layers to build dynamic page view

One server multi-instance replication completed

 Configure environment variables for tomcat multi-instance

vim /etc/profile.d/tomcat.sh configures the environment variables of tomcat1 and tomcat2

 Enter tomcat1 to modify the configuration

 Test whether the communication port is normal

 normal connection

 toncat 2 configuration modification

Modify these three

 

 

 The port configuration modification is complete

modify tomcat1

shudown

 Point the startup files to tomcat1 respectively

tomcat2

Modify tomcat2

 Adding files is the same

tomcat1 2 multi-instance configuration completed

Start the tomcat2 service

 Start the tomcat1 service

 tomcat2 success

 tomcat1 success

 Nginx and tomcat achieve dynamic and static separation

nginx configuration

 Set call address and configure weight

 Dynamic request configuration

proxy_pass http://tomcat_server;
       #Set the back-end web server to obtain the real IP of the remote client

 proxy_set_header HOST $host;
       #Assign $remote_addr to X-Real-IP to get the source IP
proxy_set_header X-Real-IP $remote_addr;
       #When nginx is used as a proxy server, the set IP list will pass through the machine ip, Proxy machine ip is recorded
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

  #Configure Nginx to handle static image requests

Static page request.

 nginx configuration complete

 Create a new directory in tomcat1 and set dynamic access content

edit access page

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<html>

<head>
<title>JSP test1 page</title>
</head>

<body>

<% out.println("Dynamic page 1,http://www.test1.com");%>
</body>
<ml>

 tomcat1 completed

 Multi-instance server, tomcat2 page editing completed

 need to be separated

delete it

 tomcat1 setup complete

 Modify the tomcat2 configuration and delete unnecessary ones first

tomcat2

 Multi-instance server configuration is complete

Check whether the tomcat service is normal

 

 normal service

 Access page for deployment 19

  cd /usr/local/

 Similarly, delete unnecessary

 

 Note the file location

restart service

 Multi-instance services are also restarted

 

 

 reboot complete

 

 static access 1

 

Guess you like

Origin blog.csdn.net/Breeze_nebula/article/details/132246438