将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. [BigData - Hadoop - YARN] YARN:下一代 Hadoop 计算平台

    Apache Hadoop 是最流行的大数据处理工具之一.它多年来被许多公司成功部署在生产中.尽管 Hadoop 被视为可靠的.可扩展的.富有成本效益的解决方案,但大型开发人员社区仍在不断改进它.最终 ...

  2. eslint 入门学习

    想学eslint已经很久了,可是每次进到官网看一下就觉得头大,无法下手,但是最近到了年底,进行年度总结,作为一个有志向的程序媛,还是要追求编码规范的,因此今天再次拿起来了eslint,记录一下我的学习 ...

  3. Java知多少(87)选择框和单选按钮

    选择框.单选框和单选按钮都是选择组件,选择组件有两种状态,一种是选中(on),另一种是未选中(off),它们提供一种简单的 “on/off”选择功能,让用户在一组选择项目中作选择. 选择框 选择框(J ...

  4. Android 数据库 大量插入 事务开启

    对比在Android中批量插入数据的3中方式对比(各插入1W条数据所花费的时间): 1. 一个一个插入 publicstaticboolean insert(SQLiteOpenHelper open ...

  5. OpenGL 太阳系行星拾取例子(GL_SELECT) VS2008 + glut实现

    太阳系:Solar System 以太阳(Sun)为中心,由内到外分别是: 水星(Mercury) 金星(Venus) 地球(Earth) 火星(Mars) 木星(Jupiter) 土星(Saturn ...

  6. [BOOK] Applied Math and Machine Learning Basics

    <Deep Learning> Ian Goodfellow Yoshua Bengio Aaron Courvill 关于此书Part One重难点的个人阅读笔记. 2.7 Eigend ...

  7. [Node.js] 05 - Modules and Function

    一个 Node.js 文件就是一个模块,这个文件可能是JavaScript 代码.JSON 或者编译过的C/C++ 扩展. 模块是Node.js 应用程序的基本组成部分,文件和模块是一一对应的. No ...

  8. Android文档-开发者指南-第一部分:入门-中英文对照版

    发布的博客,排版太不行了,整理下发在百度盘上了: 第一部分:Introduction(入门) 0.Introduction to Android(引进到Android) 1.Application F ...

  9. SpringMVC -- @RequestMapping -- 随记

    @RequestMapping RequestMapping是一个用来处理请求地址映射的注解,可用于类或方法上.用于类上,表示类中的所有响应请求的方法都是以该地址作为父路径. RequestMappi ...

  10. [原]Jenkins(十二)---jenkins管理员用户无法登陆解决办法Access Denied

    /** * lihaibo * 文章内容都是根据自己工作情况实践得出. *如有错误,请指正 * 版权声明:本博客欢迎转发,但请保留原作者信息! http://www.cnblogs.com/horiz ...