将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. 9-9-B+树-查找-第9章-《数据结构》课本源码-严蔚敏吴伟民版

    课本源码部分 第9章  查找 - B+树 ——<数据结构>-严蔚敏.吴伟民版        源码使用说明  链接☛☛☛ <数据结构-C语言版>(严蔚敏,吴伟民版)课本源码+习题 ...

  2. python(60):configparser 函数,配置文件

    ConfigParser模块学习 介绍 ConfigParser模块在python中是用来读取配置文件,配置文件的格式跟windows下的ini配置文件相似,可以包含一个或多个节(section),每 ...

  3. 设计模式---策略模式Strategy(对象行为型)

    1. 概述 策略模式定义了一系列的算法,并将每一个算法封装起来,而且使它们还可以相互替换.策略模式让算法独立于使用它的客户而独立变化. 策略模式是对算法的封装,它把算法的责任和算法本身分割开,委派给不 ...

  4. Java知多少(88)列表和组合框

    列表和组合框是又一类供用户选择的界面组件,用于在一组选择项目选择,组合框还可以输入新的选择. 列表 列表(JList)在界面中表现为列表框,是JList类或它的子类的对象.程序可以在列表框中加入多个文 ...

  5. token令牌和jwt

    用户登录,后端生成token返回给前端 前端拿到token,以后每次登录使用header里的token进行权限验证 后端接收到前端传来的token,如果是通过数据库或redis或session进行比对 ...

  6. Java如何读取和下载网页?

    在Java编程中,如何读取和下载网页? 以下示例显示如何使用net.URL类的URL()构造函数来读取和下载网页. package com.yiibai; import java.io.Buffere ...

  7. easyradius隆重发布ROS API计费接口,支持ROS 3.3以上版本,实现简单快捷的ROS宽带计费系统云端版

    easyradius对接ROS也是使用的是ROS的api接口,即您要开启 /ip /service api服务,不了解api接口的,可以自己百度噢 开启API,就到easyradius配置通讯接口,具 ...

  8. ubuntu下mysql远程连接和访问慢的解决方法

    原本连接很快的mysql服务器,连接速度奇慢.以前几十毫秒的连接现在完成一次要近5秒钟,在排除了网络问题后,只有从mysql下手.原来每次访问db,mysql就会试图去解析来访问的机器的domain ...

  9. IOC容器特性注入第六篇:利用MVC注入点,把容器启动

    这里是利用MVC三个注入点中的:IDependencyResolver 进行注入 在全局类中Global.asax代码如下: #region MVC Inject System.Web.Mvc.Dep ...

  10. [Tensorflow] Cookbook - Object Classification based on CIFAR-10

    Convolutional Neural Networks (CNNs) are responsible for the major breakthroughs in image recognitio ...