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