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.