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

  • 相关阅读:
    [置顶] Android中使用sqlite3操作SQLite
    我们不应歧视任何语言,她们都是萌娘!(有图有真相)
    一牛人博客导航
    机器学习&数据挖掘笔记_14(GMM-HMM语音识别简单理解)
    机器学习&数据挖掘笔记_16(常见面试之机器学习算法思想简单梳理)
    机器学习、深度学习、数据挖掘各种资源整理
    MLP 之手写数字识别
    卷积神经网络CNN 手写数字识别
    支持向量机SVM 简要推导过程
    23种设计模式
  • 原文地址:https://www.cnblogs.com/hugetong/p/8625847.html
Copyright © 2011-2022 走看看