Nginx series ~ Implementation of Server Load balancer and WWW Server

Source: Internet
Author: User

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 !!!

Nginx series ~ Implementation of Server Load balancer and WWW Server

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.