/;
Proxy_set_header Host $host;
Proxy_set_header X-real-ip $remote _addr;
Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for;
}
Location/
{
Proxy_pass http://bbb.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;
}
}
Descriptionmore than 1 of the aaa.com and bbb.com in the configuration file are custom and write-free. 2 The server in upstream can write multiple,
"Load balancing using Nginx for Nodejs applications"
Author: Chszs, reprint need to indicate. Blog home:Http://blog.csdn.net/chszs
Load balancing allows the user's requests to be distributed across multiple servers for processing, enabling access to a huge number of users.
protocol can be.Example:Proxy_pass Https://web1;When you set load balancing for fastcgi,uwsgi,scgi or memcached, you also need to use the Fastcgi_pass,uwsgi_pass,scgi_pass and memcached_pass instructions separately.2. * * Minimum connection number algorithm Least connected * *If you want to more balance the load of each application, the least-connection algorith
= Ngx_queue_head (posted); ev = Ngx_queue_data (q, ngx_event_t, queue); NGX_LOG_DEBUG1 ( Ngx_log_debug_event, Cycle->log, 0, "posted event%p", Ev), ngx_delete_posted_event (EV);/* Event callback function */ev->handler ( EV);}}Core processing functions of the Ngx_process_events eventThis method, we mainly look at the ngx_epoll_process_events method under the Epoll model (NGX_EPOLL_MODULE.C)1. If a lock is reached, the Accpet/read event is placed on the queue for deferred processing.2. Processes
; (down indicates that the current server is temporarily not participating in the load)Server 127.0.0.1:8080 weight=2; (weight defaults to 1.weight, the greater the load weight)Server 127.0.0.1:6060;Server 127.0.0.1:7070 backup; (When all other non-backup machines are down or busy, request the backup machine)}Max_fails: The number of times that a request failed is allowed defaults to 1. Returns the error de
Nginx + Keepalived load balancing high availability (dual-machine Hot Backup), nginxkeepalivedNginx + Keepalived load balancing high availability (dual-machine Hot Backup)1.1 Nginx installation and configuration1.2 install and con
LVS introduction:
The LVS cluster has three configuration modes: DR, Tun, and Nat. You can perform Load Balancing for WWW Service, FTP service, and mail service. below, you can build a load balancing instance for WWW Service, DRDs-based LVS cluster configuration
Director-server: core server of LVS, which is similar t
Nginx Load BalancingUnderstanding of Nginx Load BalancingNginx is a lightweight, high-performance webserver, he can mainly do the following two things:As an HTTP server (as with Apache)Load balancing as a reverse proxy serverNow
Session sharingWe are doing site testing, usually need to save some basic user information, such as login will use the session, when the use of Nginx load balancing, when users browse the site will be assigned to a different server, at this time if the session after login on different servers, A remember the user's login status, but the next time the user request
be the most front-end server, or nginx can not get the correct IP, it can not be based on IP as a hash. For example, the use of squid as the most front-end, then the Nginx IP can only get Squid server IP address, with this address to shunt is definitely confused.The back end of the 2.nginx also has other ways of load
$remote _addr;
Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for;
Proxy_pass http://$geo. Server$request_uri;
} error_page 502 503 504/50x.html;
Location =/50x.html {root html; } Server {Listen 8080;
server_name 192.168.6.121;
Location/{root HTML;
Index index.html index.htm;
}
}
}
3. Test, open the browser input on test machine 1http://192.168.6.121Show
Because the test machine 1 IP address for 192.168.6.2 according to
Nginx+keepalived Load Balancing high availability (dual standby)1.1 Nginx Installation and configuration1.2 Keepalived Installation and configuration1.3 Webserver Installation1.4 Test Nginx+keepalivedThe environment is as follows:CentOS 6.4_64keepalived-1.2.12Nginx-1.4.4vip:
-1.3.15]#./configure--prefix=/usr/local/nginxError:./configure:error:the HTTP Rewrite module requires the PCRE library.You can either disable the module by using--without-http_rewrite_moduleoption, or install the PCRE library into the system, or build the PCRE libraryStatically from the source with Nginx by using--with-pcre=You need to install the dependent package Pcre:[email protected] nginx-1.3.15]# yum
I. Basic description of Load Balancing
1.1 Why to use Nginx
With this image we can see that nginx performance is significantly better than Apache and lighttpd, so we use Nginx to load balance.
So how do we achieve
Before using Nginx did the Web reverse proxy, did not do load balancing, today there is a classmate need to do Tomcat load balancing, I also studied.
There are altogether 2 machines, one physical machine (Win7) that deploys 2 tomcat, which is started with a different po
the access request for the same IP address is assigned to that node . can solve the session sharing problem2.4 Url_hash:each URL is directed to the same back-end server based on the hash result of the URL that the user accesses2.5 Fair:Fair is a more intelligent load balancing algorithm , which can be based on the size of the page and the loading time of intelligent lo
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.