Nginx+tomcat Load Balancing Configuration

Source: Internet
Author: User
Tags nginx server

Nginx Load Balancer Configuration

First, the environment:

Three machines for Centos6.7 systems

10.61.6.182 Nginx Server

10.61.6.184 Tomcat Server

10.61.6.152 Tomcat Server

Second, the installation of Nginx:

In the above three machines are connected to the state of the Nginx installation is very convenient, if it is not connected to the machine that may be tragic, need to follow the instructions of the installation of various libraries, I feel quite troublesome.

1. Installing Pcre

2. Installing OpenSSL

3. Installing zlib

Three major strides are needed, configure--->make---> Make install

The above are ready to install Nginx, the above steps in the online search should be able to find.

Simple Network topology diagram:


Three, prepare a project to be tested, here I simply created a javaweb project called Nginxdemo, the inside after a index.jsp page, packaged into two, the only difference is that the content is written differently, in order to test whether load balancing function.


You can put Nginxdemo into WebApps in the Tomcat directory with the Tomcat server first.

Configuration files for configuring Nginx


Adding Upstream,jsp_server in HTTP is named after yourself and can be a name you like. The following two servers are the machines and ports where Tomcat resides.

Some of the content that was commented out and the added location purpose is to access the JSP.

Start Nginx, and then access the Nginxdemo project in the browser


Constantly refresh the browser will find that the content is not the same, here 8091 is the configuration of the Nginx listening port, you can set their own.

The above describes the Nginx+tomcat load balancing configuration, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Related Article

    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.