Deploy two Tomcats on the same server and use Nginx to achieve load sharing

WBOY
Release: 2016-08-08 09:28:42
Original
1385 people have browsed it

In order to achieve server upgrade without affecting user use, it is necessary to configure two tomcats in one or more servers. The following describes the process of configuring two Tomcats 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, and change the shutdown and Connector ports to another one. Value, such as 8006/8090

3. Modify the startup.sh and shutdown.sh files and add in the first line:

export CATALINA_HOME=/opt/app/tomcat-8090

4. Start tomcat

5. Configure load balancing in Nginx:

Nginx configuration file, add:

upstream tomcatCluster {

           server :8080                                                                                                                                                            Server <

server

{

listen 80;

                                                                                                                          ,                                                                   ;

location ~* // {

                                                                                                                    proxy_pass http://tomcatCluster; ginx: service nginx restart

6. Test whether the request is forwarded to two tomcats in turn

The above introduces how to deploy two Tomcats on the same server and use Nginx to achieve load sharing, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template