MORE: http://www.webyang.net/Html/web/article_137.html
Nginx is configured to run in the form of a reverse proxy, and the actual processing of the request needs to be forwarded to the backend server for execution. Back-end servers may have one or more, how to choose a suitable back-end server to handle the current request is the Nginx load balancing.
Nginx can not only be a powerful Web server, but also as a reverse proxy server, and Nginx can also follow the schedule rules to achieve dynamic, static page separation, you can follow the polling, IP hash, url hash, weight and other ways to load balance the backend server.
If there is only one server, the server hangs up, then it is a disaster for the website. As a result, load balancing at this time will be a kick-off, and it will automatically eliminate the servers that are hung up.
Load Balancer Module Load-balance is an auxiliary module, mainly for the upstream module service, the goal is clear and single: How to choose a suitable server from multiple back-end servers to handle.
Simple example:
- http {
- upstream MyProject {
- Server 127.0 . 0.1 : 8000 Weight = 3 ;
- Server 127.0 . 0.1 : 8001 ;
- Server 127.0 . 0.1 : 8002 ;
- Server 127.0 . 0.1 : 8003 ;
- }
- Server {
- Listen the ;
- server_name www . Domain . com ;
- Location / {
- Proxy_pass http : //myproject;
- }
- }
- }
Other normal configurations are available.
Today is the beginning of the Big five, I wish you a happy New Year! In addition: study together, make progress together ~
Simple Nginx Load Balance example