Nginx Proxy load Balancing is simple

Source: Internet
Author: User

Installing Nginx

wget http://nginx.org/download/nginx-1.10.0.tar.gz

Tar XF nginx-1.10.0.tar.gz

CD nginx-1.10.0

./configure--user=nginx--group=nginx--prefix=/application/nginx.1.10.0--with-http_stub_status_module--with-h Ttp_ssl_module

Make

Make Isntall

Ln-s/application/nginx.1.10.0//application/nginx

Useradd nginx-s/sbin/nologin-m

/application/nginx/sbin/nginx-t

/application/nginx/sbin/nginx

Egrep-v "#|^$" Nginx.conf.default > nginx.conf

Vim nginx.conf

http{

Upstream Backend {

Ip_hash; After landing, always on a server

Server 192.168.10.11:80 max_fails=3 fail_timeout=30s;

Server 192.168.10.16:80 max_fails=3 fail_timeout=30s;

}

server {

Listen 80;

server_name www.hequan.com;

Index index.html index.htm;

Location/{

proxy_pass http://backend;

}

}

This time open 192.168.10.10, is the way to poll RR , Access 11 and 16.

Test

For n in ' seq 100 '; Do curl 192.168.10.10; Sleep 2;d One

Lnmp-----------www.hequan.com

Lamp-www.hequan.com

Lnmp-----------www.hequan.com

Lamp-www.hequan.com

After shutting down a server, the access is normal and does not affect. This server is automatically added to the inside when it is normal. Provide access.

Each server writes the login information to the local, it will affect the user login, back and forth the situation.

The LB layer can do the session hold (small traffic can) in order to prevent, can join Ip_hash; after landing, always on a server

Software Layer Sesson Replication

Sharing such as Memcache

Cookies are used to cache user-level session information in the user's local

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>


This article is from the "what-all" blog, please be sure to keep this source http://hequan.blog.51cto.com/5701886/1768714

Nginx Proxy load Balancing is simple

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.