In order to implement a server upgrade without impacting the user, it is necessary to configure two tomcat in one or more servers. The following describes the process of configuring two Tomcat on the same server.
The steps are as follows:
1, copy the original tomcat to another directory, such as: tomcat-8090, clear the Logs directory
2. Modify the Server.xml file in Tomcat to change the shutdown and connector ports to another value, such as 8006/8090
3, modify the startup.sh and shutdown.sh files, in the first line to add:
Export catalina_home=/opt/app/tomcat-8090
4. Start Tomcat
5. Configure load Balancing in Nginx:
Nginx config file, add:
Upstream Tomcatcluster {
Server : 8080;
Server : 8090;
}
Server
{
Listen 80;
server_name ... <域名> ;
Index ...;
Root ...;
Location/{
Location ~*/ <项目名> /{
Proxy_pass Http://tomcatCluster;
}
}
}
Restart Nginx:service nginx Restart
6. Whether the test request is forwarded to two Tomcat in turn
The above describes the same server deployment of two Tomcat with nginx load sharing, including aspects of the content, I hope the PHP tutorial interested in a friend helpful.