: This article describes how to deploy two Tomcat servers on the same server and share the load with Nginx. For more information about PHP tutorials, see. To achieve server upgrade without affecting user usage, it is necessary to configure two tomcat servers in one or more servers. The following describes how to configure two Tomcat servers on the same server.
The procedure is as follows:
1. copy the original Tomcat to another directory, for example, tomcat-8090. clear the logs directory.
2. modify the server. xml file in Tomcat and change the shutdown and Connector ports to another value, such as 8006/8090.
3. modify the startup. sh and shutdown. sh files and add the following to the first line:
Export CATALINA_HOME =/opt/app/tomcat-8090
4. start tomcat
5. configure server load balancer in Nginx:
Nginx configuration file, add:
Upstream tomcatCluster {
Server : 8080;
Server : 8090;
}
Server
{
Listen 80;
Server_name <Domain name> ......;
Index ......;
Root ......;
Location /{
Location ~ */ <Project name> /{
Proxy_pass http: // tomcatCluster;
}
}
}
Restart Nginx: service nginx restart
6. test whether requests are forwarded to two tomcat servers in turn.
The preceding section describes how to deploy two Tomcat servers on the same server and use Nginx to share the load, including some content. if you are interested in the PHP Tutorial.