Deploy two Tomcat servers on the same server and use Nginx for Load Balancing

Source: Internet
Author: User

Deploy two Tomcat servers on the same server and use Nginx for Load Balancing

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 <ip>: 8080;
Server <ip>: 8090;
}
Server
{
Listen 80;
Server_name <ip> <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.

Tomcat Load Balancing using Nginx reverse proxy in CentOS 6.5

Load Balancing between Apache and multiple Tomcat clusters in Linux

Nginx Tomcat Cluster load balancing solution notes

Instance details Tomcat component installation + Nginx reverse proxy Tomcat + Apache use mod_jk and mod_proxy Reverse Proxy and load balancing

Deploy a log server using Rsyslog + LogAnalyzer + MySQL in CentOS 6.5

Build an Apache + Tomcat environment (JK deployment process)

Tomcat details: click here
Tomcat: click here

This article permanently updates the link address:

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.