Nginx series ~ Implementation of Server Load balancer and WWW server, nginx Load Balancing

Source: Internet
Author: User
Tags nginx load balancing

Nginx series ~ Implementation of Server Load balancer and WWW server, nginx Load Balancing

The last two lectures are mainly about the Nginx environment, which does not involve the development of the real environment. In this example, describe how to configure Nginx for the Server Load balancer and WWW server and how to implement it.

The following is an actual scenario: One Server Load balancer Server, and two WWW servers Client1 and Client2. data between B and C is synchronized. You can use a third-party software for synchronization.

The configuration of nginx. conf on the Server side is as follows:

upstream www.zzl.com {     server 192.168.2.72:80;     server 192.168.2.4:80;     server 192.168.2.5:80;}    server {        listen    80;        server_name  www.zzl.com;        #charset koi8-r;        #access_log  logs/host.access.log  main;       location / {         proxy_pass http://www.zzl.com;         proxy_set_header Host $host;         proxy_set_header X-Real-IP $remote_addr;         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;     } 

The configurations of Client1 and Client2 are as follows:

  server {        listen       80;        server_name  www.zzl.com;

OK. After setting, load your nginx reload nginx-s reload.

This is the success !!!


How to distribute multiple nginx instances and achieve Load Balancing for large domestic websites?

This information is basically incomplete. Let me talk about a basic architecture:
1. If you have sufficient funds for the DNS server, we recommend using the BGP data center. Two or three DNS servers are balanced. bind software is usually used. If the funds are tight, you can purchase professional dns services, such as dnspod in China.
2. For CDN servers, you can buy services from professional companies, such as chinacache, if you want to save time in the first place. However, the development costs will increase. If you build your own servers, you may set up servers in different data centers, such as China Telecom, China Unicom, and China Mobile, and use dns for dynamic resolution. For ultra-large websites, you can use Squid, nginx for medium to large sizes, and varnish for internal use.
3. Balance the front-end. If you have enough funds, you can use up to 100,001 hardware devices. If you already have a technical team, use nginx/haproxy + keepalived to build your own front-end. Balanced methods are flexible, with random, weight, ip, and url options.
4. Synchronization depends on what to synchronize. Common files can be synchronized in real time. However, if the database is used, you must select the synchronization mode for the specific type.
5. the backend application servers and database clusters should be based on traffic planning.

In linux, it is okay for nginx Server Load balancer to access the server separately. The Server Load balancer page cannot be loaded. Why?

This is a configuration problem for the first class. You can paste the configuration,
In addition, ngix must be connected to the server during configuration.
 

Related Article

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.