Nginx Upstream Module

Source: Internet
Author: User

Reference documents

Nginx Upstream Module

Http://www.nginx.cn/doc/standard/httpupstream.html



  1. #upstream模块: For load Balancing, reverse proxy (proxy fastcgi uwsgi scgi memcached)


  2. #语法: Upstream name {...}

  3. Upstream Static_server {

  4. Server a*:80 max_fails=2 fail_timeout=5s;

  5. Serve b*:80 max_fails=2 fail_timeout=5s;

  6. Server c*:80 max_fails=2 fail_timeout=5s backup;

  7. KeepAlive 4;

  8. }

  9. Groups of #定义了一个名为static_server

  10. The ip+ of the #server + back-end server corresponds to the port number that provides the service

  11. #max_fails: The number of failed requests defaults to 2, which returns the error defined by the Proxy_next_upstream module when the maximum number of times is exceeded

  12. #fail_timeout: It is associated with max_fails, if the request fails within 5s 2 times, then Nginx thinks this server has been hung, so that no longer query it within 5s

  13. #backup: Indicates that Nginx will distribute the request only when the backend server is unavailable


  14. # KeepAlive 4: Activate a long connection to the backend machine, support HTTP fastcgi memcache, this number should be set to a small point so that the backend server can accept the new connection at the same time, if the number is exceeded, the least recently used connection will be closed.

  15. #srun_id =pnet1: Indicates that a label is set on this server, primarily to differentiate back-end servers


  16. #jvm_route: Based on Jsessionid in a cookie, determine which server the request is sent to the backend

  17. #通过jvm_route解决session不一致的问题

  18. Upstream Puic-net {

  19. Server e*:39921 srun_id=pnet1 max_fails=2 fail_timeout=5s;

  20. Server f*:10021 Srun_id=pnet2 max_fails=2 fail_timeout=5s;

  21. Server g*:11021 srun_id=pnet3 max_fails=2 fail_timeout=5s;

  22. Server h*:39922 srun_id=pnet4 max_fails=2 fail_timeout=5s;

  23. Jvm_route $cookie _jsessionid|sessionid Reverse;

  24. KeepAlive 4;

  25. }

This article is from the It Dick thread blog, so be sure to keep this source http://68686789.blog.51cto.com/10438688/1750596

Nginx Upstream Module

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.