将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. I帧、P帧、B帧、GOP、IDR 和PTS, DTS之间的关系

    一.视频传输原理 视频是利用人眼视觉暂留的原理,通过播放一系列的图片,使人眼产生运动的感觉.单纯传输视频画面,视频量非常大,对现有的网络和存储来说是不可接受的.为了能够使视频便于传输和存储,人们发现视 ...

  2. [转]protoc-gen-lua 编译、安装、使用教程

    版权声明:本文转自http://blog.csdn.net/huutu 转载请带上 http://www.liveslives.com/ https://blog.csdn.net/cp7906216 ...

  3. Oracle的NVL函数用法

    从两个表达式返回一个非 null 值. 语法 NVL(eExpression1, eExpression2) 参数eExpression1, eExpression2 如果 eExpression1 ...

  4. 牛客网_Go语言相关练习_选择题(2)

    注:题目来源均出自牛客网. 一.选择题 Map(集合)属于Go的内置类型,不需要引入其它库即可使用. Go-Map_菜鸟教程 在函数声明中,返回的参数要么都有变量名,要么都没有. C选项函数声明语法有 ...

  5. 嵌入式开发之hi3519---i2c MDIO PHY uboot phy调试总结

    首先调试检查硬件,再调试软件 首先仔细阅读phy和主芯片datesheet ,尤其着重阅读mii寄存器,它是mac和phy交换信息的媒介. 硬件注意:关于phy的芯片需要注意的有几点:1.mdio接口 ...

  6. Git -- 搭建git服务器

    在远程仓库一节中,我们讲了远程仓库实际上和本地仓库没啥不同,纯粹为了7x24小时开机并交换大家的修改. GitHub就是一个免费托管开源代码的远程仓库.但是对于某些视源代码如生命的商业公司来说,既不想 ...

  7. [Unity3D] 05 - Access to DB or AWS

    可以选择连接本地服务器,或者云服务器. 参考源代码 : https://www.cnblogs.com/wuzhang/p/wuzhang20141202.html (1) 功能:点击一下按键,然后访 ...

  8. 51 IP核查询

    康芯的IP核 Oregano systems 公司的MC8051 IP CoreSynthesizeable VHDL Microcontroller IP-Core User Guide这个里面51 ...

  9. cocos2d-x游戏引擎核心(3.x)----启动渲染流程

    (1) 首先,这里以win32平台下为例子.win32下游戏的启动都是从win32目录下main文件开始的,即是游戏的入口函数,如下: #include "main.h" #inc ...

  10. redis aof和rdb区别

    转自https://blog.csdn.net/m0_38110132/article/details/76906422 1.前言 最近在项目中使用到Redis做缓存,方便多个业务进程之间共享数据.由 ...