zoukankan      html  css  js  c++  java
  • [nginx] load balancing & location

    将NGINX配置成7层load balancer,该怎么做?

    参见:

    http://nginx.org/en/docs/http/load_balancing.html

    https://docs.nginx.com/nginx/admin-guide/load-balancer/http-load-balancer/

    https://www.nginx.com/blog/nginx-load-balance-deployment-models/?_ga=2.46277799.1689967697.1521711772-726225183.1521711772

    其中,分发的一个关键节点是location关键字的值。

    见location命令的描述:http://nginx.org/en/docs/http/ngx_http_core_module.html#location

     摘要:

     1.   描述方式:

      a。 前缀字符串

      b。 正则表达式

        1 大小写敏感

        2  大小写不敏感

     2.  优先匹配顺序。

      a。先检查前缀字符串。

        1. 多个匹配的时候,最长的匹配前缀将被选中并记住。

        2. 当选中的最长前缀由 ”^~“ 进行修饰的时候,将不再检查正则表达式。

      b。 再检查正则表达式。

        1.  按照配置文件中出现的前后顺序逐条检查,遇到第一条匹配时即停止。

        2.  如果没有匹配到正则,之前记录下的最长前缀匹配将被使用。

     3. 正则表达式支持capture

     4. 精准匹配

        使用 “=” 修饰,匹配到之后,匹配将立刻结束。

     5. @符号

        Such a location is not used for a regular request processing, but instead used for request redirection.

     6.

    If a location is defined by a prefix string that ends with the slash character, and requests are processed by one of proxy_pass, fastcgi_pass, uwsgi_pass, 
    scgi_pass, or memcached_pass, then the special processing is performed. In response to a request with URI equal to this string, but without the trailing
    slash, a permanent redirect with the code 301 will be returned to the requested URI with the slash appended. If this is not desired, an exact match of the
    URI and location could be defined like this:

     7. 嵌套的location

      https://serverfault.com/questions/496371/nested-locations-nginx

    读nginx与location相关的代码

  • 相关阅读:
    hibernate怎么做分页
    JS+CSS带数字和左右按钮可控制切换的图片幻灯
    AOP下的权限控制实现
    Hibernate3和MyBatis(iBatis)的执行效率比较
    CKEditor/FCKEditor 使用-CKeditor 3.0.1 快速教程(含插入图片)
    用JS写CSS
    spring aop实现权限控制,路径控制
    sql server 同步复制要点
    千万别把自己当人才
    web.xml元素介绍
  • 原文地址:https://www.cnblogs.com/hugetong/p/8625847.html
Copyright © 2011-2022 走看看