Deploy two tomcat on the same server with Nginx for load sharing

Source: Internet
Author: User
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.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.