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

[nginx] load balancing & location的更多相关文章

  1. NGINX Load Balancing – TCP and UDP Load Balancer

    This chapter describes how to use NGINX Plus and open source NGINX to proxy and load balance TCP and ...

  2. NGINX Load Balancing - HTTP Load Balancer

    This chapter describes how to use NGINX and NGINX Plus as a load balancer. Overview Load balancing a ...

  3. Load Balancing with NGINX 负载均衡算法

    Using nginx as HTTP load balancer Using nginx as HTTP load balancer http://nginx.org/en/docs/http/lo ...

  4. NGINX Docs | Load Balancing Apache Tomcat Servers with NGINX Open Source and NGINX Plus

    NGINX Docs | Load Balancing Apache Tomcat Servers with NGINX Open Source and NGINX Plushttps://docs. ...

  5. How Network Load Balancing Technology Works--reference

    http://technet.microsoft.com/en-us/library/cc756878(v=ws.10).aspx In this section Network Load Balan ...

  6. 负载均衡(Load Balancing)学习笔记(二)

    概述 文章负载均衡(Load Balancing)学习笔记(一) 讲述了负载均衡的一般性原理,本文继续介绍常见的实现负载均衡的方法. HTTP重定向 HTTP重定向服务器是一台普通的Web服务器,用户 ...

  7. 负载均衡(Load Balancing)学习笔记(一)

    概述 在分布式系统中,负载均衡(Load Balancing)是一种将任务分派到多个服务端进程的方法.例如,将一个HTTP请求派发到实际的Web服务器中执行的过程就涉及负载均衡的实现.一个HTTP请求 ...

  8. Elastic Load Balancing with Sticky Sessions

    Elastic Load Balancing with Sticky Sessions — Shlomo Swidler https://shlomoswidler.com/2010/04/elast ...

  9. How to Configure Tomcat/JBoss and Apache HTTPD for Load Balancing and Failover

    http://java.dzone.com/articles/how-configure-tomcatjboss-and In this post we will see how to setup a ...

随机推荐

  1. js正则表达式验证身份证号和密码

    //验证身份证号只能输入15位或者18位的身份证号 /^\d{14}[X|\d]{1}$|^\d{18}$/ig //验证只能输入字母和数字组合6到16位 /^[a-z][a-z0-9]{6,16}$ ...

  2. TCP/IP协议理解

    TCP/IP协议理解 一.    协议分层 由于ISO标准中的网络模型是个7层模型,但是由于7层模型对于当时的网络厂商来说太过复杂,很多厂家采用了简化的4层模型来实现网络设备,4层模型也就成了事实的网 ...

  3. SAP Study Notes: BW Queriy-Variables(变量)

    About Variable:1.Variable 是和InfoObject绑定的,可用于任何含有该IO的query中.2.Variable有以下几种类型:Characteristic:用于限制Cha ...

  4. Linux下apache activemq的安装与配置

    ActiveMQ 是Apache出品,最流行的,能力强劲的开源消息总线.ActiveMQ 是一个完全支持JMS1.1和J2EE 1.4规范 的 JMS Provider实现,尽管JMS规范出台已经是很 ...

  5. Java知多少(44)异常类型

    所有异常类型都是内置类Throwable的子类.因此,Throwable在异常类层次结构的顶层.紧接着Throwable下面的是两个把异常分成两个不同分支的子类.一个分支是Exception. 该类用 ...

  6. CentOS7 配置免密码登陆

    3台主机 192.168.30.207 Master 192.168.30.251 Node1 192.168.30.252 Node2 三台主机检查 ~/.ssh 文件夹,没有则新建 在master ...

  7. EventBus vs Otto vs Guava--自定义消息总线

    同步发表于http://avenwu.net/ioc/2015/01/29/custom_eventbus Fork on github https://github.com/avenwu/suppo ...

  8. Virtualbox的centos7 nat和桥接网络配置

    在实际配置虚拟机的过程中,网络配置时候一个很繁琐的过程,经常一个点没注意到,就访问不了了.在此,做一个简单的教程以供后续使用时可以参考! 方法一: 使用NAT网络 1. 选择网卡 安装centos7的 ...

  9. Scala学习笔记——内建控制结构

    Scala的内建控制结构包括:if.while.for.try.match和函数调用 1.if表达式 //常见的写法 var filename = "name" if (!args ...

  10. excel中批量删除公式,保留数值

    excel中批量删除公式,保留数值 Sub macro1() Dim sh As Worksheet For Each sh In Sheets sh.UsedRange = sh.UsedRange ...