Home > Backend Development > PHP Tutorial > Nginx+tomcat load balancing configuration

Nginx+tomcat load balancing configuration

WBOY
Release: 2016-07-29 08:51:19
Original
1486 people have browsed it

Nginx load balancing configuration

1. Environment:

           Three Centos6.7 system machines

                                                                                                                                                     

10.61.6.152 tomcat server

2. Nginx installation:

  It is very convenient to install nginx when the above three machines are connected to the Internet. If the machine is not connected to the Internet, it may be a tragedy. You need to follow the prompts to install various libraries, which I find quite troublesome.

1. Installing pcre

2. Installing openssl

3. Installing zlib

basically requires three major steps, configure --->make ---> make install

The above are all ready. You can install nginx. You should be able to find the above steps by searching online.

Simple network topology diagram:

Nginx+tomcat load balancing configuration
3. Prepare a project to be tested. Here I simply created a javaweb project called NginxDemo, with an index.jsp page inside, packaged into two. The only difference is The difference is that the content written is different, in order to test whether load balancing works.将 先

can first put NginxDemo in the WebApps under the Tomcat directory with the Tomcat server. In 4. Configuration files configured nginx Nginx+tomcat load balancing configuration

Nginx+tomcat load balancing configuration

added upstream in HTTP. JSP_SERVER is named by itself, and you can start a name you like. The following two servers are the machines and ports where tomcat is located.

Nginx+tomcat load balancing configuration
The above picture shows some commented out content and the added location for the purpose of accessing jsp.

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

Nginx+tomcat load balancing configuration

Keep refreshing the browser and you will find that the displayed content is different. 8091 here is the configured Nginx listening port. You can set by oneself.

Nginx+tomcat load balancing configuration

The above introduces the Nginx+tomcat load balancing configuration, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Nginx+tomcat load balancing configuration

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