Load balancing with multiple tomcat and Nginx under one server

Source: Internet
Author: User
Tags nginx server nginx load balancing

Nginx load balancing for multiple tomcat under one machine

?

1 Download tomcat, free install version

Address: http://pan.baidu.com/s/1jGAgc5o

2. Copy a tomcat copy ( the following operation only needs to be in the copy )

The name is:

3. Modify Server.conf

Open File Location

Modify the following three places:

1.

2.

3.

?

?

?

?

?

?

?

?

4. Open Service.bat

Open File Location

?

Add the following

5 Install this Tomcat service

Command line Input: TOMCAT8.1.2 is the name of the service and is free to

?

6 start this service

needs to be started in the system Services list, i.e. services.msc found under TOMCAT8.1.2 service name, and then right-click to start, this time B-tomcat can run properly.

?

7. Testing

① in these two Tomcat , create a new project separately : Hello ; Create a new Project launch page: index.html ;

② on top 6 has been started 8888 port tomcat service, so just put Span style= "Font-family:helvetica; Background-color:white ">8080 port tomcat start.

③ input in the browser Http://localhost:8888/hello,http://localhost:8080/hello the results are as follows:

at this point, two Tomcat it's already installed.

?

?

?

Nginx Load Balancer Configuration

Download Nginx

Address: HTTP://PAN.BAIDU.COM/S/1PJGB2AF

?

Installation

Unzip to local free directory: Edit nginx.conf File:

in the http{} the contents of the following red boxes are added:

?

Starting and shutting down Nginx server

?

Test validation

  1. Installing nginx verification

    Input Installation Nginx Server's IP and listening ports: if any of the following Nginx Success!

    ?

Load Balancing Verification

guaranteed to open two tomcat server (open two tomcat ports are: 8080 and 8888 )

    1. Native input: http://localhost:81/hello/,
    2. Other machines enter the IP address of the installation Nginx server + port (81) + Project name/
    3. The result is: Switch between two tomcat: (e.g.:)

      At this point, nginx load balancer installation is complete!

Load balancing with multiple tomcat and Nginx under one server

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.