How to configure nginx Server Load balancer

Source: Internet
Author: User
Tags what is nginx nginx load balancing

Nginx Server Load balancer is an amazing technology that many people cannot master. Here we will introduce the problems related to nginx Server Load balancer in detail. I tried nginx Load Balancing today! What is nginx?

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 publishes source code 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.

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.

 
 
  1. Worker_processes 1;
  2. Events {
  3. Worker_connections 1024;
  4. }
  5. HTTP {
  6. Upstream myproject {
  7. # Multiple source servers, IP: Port, and port 80 can be written or not
  8. Server 192.168.43.158: 80;
  9. Server 192.168.41.167;
  10. }
  11. Server {
  12. Listen 8080;
  13. Location /{
  14. Proxy_pass http: // myproject;
  15. }
  16. }
  17. }

NginxWhat are the functions of Server Load balancer?

If one of the backend servers is broken, it can be automatically identified. Even better, nginx can immediately identify servers A and B. If the response time of A is 3, if the response time of B is 1, nginx automatically adjusts the probability of access to B to three times that of a. The installation is complete after nginx load balancing is completed. I reported an error during make, saying that the HTTP rewrite module is faulty.

./Configure-without-http_rewrite_module

Then make and make install.

After installation, create a new configuration file and copy the content of the above configuration file. Of course, modify your IP address, save it as load_balance.conf, and start it:

/Usr/local/nginx/sbin/nginx-C load_balence.conf

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 nginx load balancing.

Nginx does not have this restriction. For it, What server is next is completely transparent. Nginx is a bit uncomfortable. It cannot run in windows at present. I wrote a lot, haha .~~ If you say something wrong

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.