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相关的代码

  • 相关阅读:
    react-动画
    react-json渲染
    SQL 只取重复记录一条记录并且是最小值
    SQL 函数:树结构指定父节点遍历所有的子节点
    EasyUI treegrid 删除一条或多条记录
    String.Format数字格式化输出 {0:N2} {0:D2} {0:C2} (转)
    EasyUI 左,右(上、下)布局
    DataTable 树形构造加全部
    easyui datagrid 格式化列显示两位小数、千分位
    c# 判断文件是否已使用
  • 原文地址:https://www.cnblogs.com/hugetong/p/8625847.html
Copyright © 2011-2022 走看看