Nginx simple load balancing (a)

Nginx is a high performance http and reverse proxy server, the official test nginx can support the support 5 Wan concurrent links, and the CPU , memory and other resource consumption is very low, running very stable.

1. scenario

 

1.http server. Nginx is a http service can provide independent http service. You can do a static web page server.

2. virtual host. It can be implemented in a single server virtualized multiple sites. For example, a personal web hosting sites use

3. Reverse proxy, load balancing. When the site's traffic reaches a certain level, a single server can not meet the user's request, the need to use multiple servers can be clustered using nginx do a reverse proxy. Circumstances and multiple servers can share the load average, not because a server is down and high load a server idle

Today introduces nginx load balancing

2. What is load balancing

Load balancing based on the existing network architecture, it provides a cheap and effective way to extend the bandwidth of transparent network devices and servers increase throughput, enhance network data processing capability, flexibility, and availability of the network.

Load balancing, the English name for the Load Balance , which means that spread over multiple operating units to perform, such as Web servers, the FTP server, enterprise critical application servers and other mission-critical servers, so as to work together to complete the task.

 

nginx as a load balancing server, requests the user to reach nginx , then the nginx forwarding requests according to the load configuration tomcat server

 

nginx load balancing servers: 192.168.100.1

 

tomcat1 Server: 192.168.100.10

 

tomcat2 Server: 192.168.100.20

 

 3. The specific configuration is as follows

upstream wlvtest{

        server 192.168.100.10:8080 weight=10;

        server 192.168.100.20:8081 weight=10;

        }

 

    server {

        listen 80;

        server_name wlv.test.com;

        location / {

                 proxy_pass http://wlvtest;

                 index index.jsp index.html index.htm;

        }

    }

server_name: That request will address the request wlv.test.com designated after proxy_pass to http: // wlvtest, while upstream must be consistent with wlvtest.

When a user requests wlv.test.com, will go through nginx load balancing, it was forwarded to the 8080 and 8081 services.

 

Inadequacies also please correct me

Guess you like

Origin www.cnblogs.com/wlv1314/p/12126462.html