Nginx Load Balancing

Source: Internet
Author: User
Tags what is nginx nginx load balancing
What is nginx?
[Quote]
Nginx ("engine X") is a high-performance HTTP and reverse proxy server and an IMAP/POP3/SMTP proxy server. Nginx was developed by the rambler.ru site with the highest access volume in Russia as Igor Sysoev. It has been running on this site for more than two and a half years. Igor will Source code Issued in the form of a class BSD license. Despite being a beta version, nginx is well known for its stability, rich feature sets, sample configuration files, and low system resource consumption.
[/Quote]
First, the configuration is very simple and powerful. It's time to see each other.
Let's take a look at how to write the configuration file.

Worker_processes 1;
Events {
Worker_connections 1024;
}
HTTP {
Upstream myproject {
# Multiple source servers, IP: Port, and port 80 can be written or not
Server 192.168.43.158: 80;
Server 192.168.41.167;
}

Server {
Listen 8080;
Location /{
Proxy_pass http: // myproject;
}
}
}

What are the functions of nginx Server Load balancer?
[LIST]
[*] If one of the backend servers is broken, it can be automatically identified. Even better, nginx can be recognized immediately after it is ready.
[*] If the response time of server a and server B is 3 and the response time of server B is 1, nginx automatically adjusts the probability of access to server B to three times that of server, truly achieve Load Balancing
[/LIST]

Here I want to talk about the installation and running of nginx.
Download the latest source code package at http://www.nginx.net.
What I downloaded is nginx-0.5.33.tar.gz.
Unzip: Tar zxvf nginx-0.5.33.tar.gz
Next:./configure
Then: Make
Last: make install
Okay. The installation is complete. I reported an error when making, saying there is a problem with the HTTP rewrite module, I will./configure -- without-http_rewrite_module
Then make and make install.
After installation, create a new configuration file and copy the above configuration file. Of course, modify your IP address and save it as load_balance.conf.

Then start:
/Usr/local/nginx/sbin/nginx-C load_balence.conf

If there is a problem with the above steps, refer:
Nginx Chinese Wiki
Http://wiki.codemongers.com/NginxChs
You can also go to the official website
Www.nginx.net
Www.nginx.com

Since nginx is written by Russians, the English documents are not so complete. For me, the biggest advantage of nginx is its simple configuration and powerful functions.
I used to configure APACHE-JK, which is really not suitable for normal users. It is too complicated and can only be used for Tomcat load balancing.
Nginx does not have this restriction. For it, What server is next is completely transparent.

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.