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:
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
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
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.
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.