Simple nginxloadbalance example

Source: Internet
Author: User
: This article mainly introduces the simple nginxloadbalance example. if you are interested in the PHP Tutorial, refer to it. MORE: http://www.webyang.net/Html/web/article_137.html

Nginx is configured to run in the form of a reverse proxy. the actual processing of the request needs to be forwarded to the backend server for execution. There may be one or more backend servers. how to select a suitable backend server to process the current request is nginx server load balancer.

Nginx can be used not only as a powerful web server, but also as a reverse proxy server. nginx can also implement dynamic and static page separation according to scheduling rules, server load balancer can be performed on backend servers by means of polling, ip hash, URL hash, and weight.

If the server crashes when there is only one server, it is a disaster for the website. Therefore, the server load balancer will be ready at this time, and it will automatically remove the suspended servers.

The Load-balance module is an auxiliary module and mainly serves the Upstream module. it has a clear and single goal: how to select a suitable server from multiple backend servers for processing.

Simple example:
 
  1. http {
  2. upstream myproject {
  3. server 127.0.0.1:8000 weight=3;
  4. server 127.0.0.1:8001;
  5. server 127.0.0.1:8002;
  6. server 127.0.0.1:8003;
  7. }
  8. server {
  9. listen 80;
  10. server_name www.domain.com;
  11. location /{
  12. proxy_pass http://myproject;
  13. }
  14. }
  15. }
You can configure other configurations as usual.

Today is the fifth day of the year. wish you a happy new year! In addition, learn together and make progress together ~

The above describes the simple nginx load balance example, including some content, and hope to be helpful to friends who are interested in the PHP Tutorial.

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.