<pre name="code" class="html">/***第一种
nginx 配置:
location / {
root /var/www/zjzc-web-frontEnd;
index index.html;
} zjtest7-frontend:/var/www/zjzc-web-frontEnd/images# pwd
/var/www/zjzc-web-frontEnd/images
zjtest7-frontend:/var/www/zjzc-web-frontEnd/images# ls
3.png http://192.168.32.76:8001/images/3.png haproxy: acl image_req path_beg -i /images
use_backend imageserver_8001 if image_req backend imageserver_8001
mode http
balance roundrobin
server webhost01_8001 192.168.32.76:8001 check inter 2000 fall 3 weight 20 haproxy 如果有这行就不行
#acl url_static_zjdev path_end .html .gif .png .jpg .css .js 注释掉这行 /*******************
frontend web_service
bind *:80 acl api_req path_beg -i /api
use_backend appserver_8082 if api_req acl image_req path_beg -i /images
use_backend imageserver_8001 if image_req acl url_static path_end .html .gif .png .jpg .css .js
use_backend webserver_8001 if url_static
backend imageserver_8001
mode http
balance roundrobin
server webhost01_8001 192.168.32.76:8001 check inter 2000 fall 3 weight 20 backend webserver_8001
mode http
balance roundrobin
server webhost01_8001 192.168.32.213:8001 check inter 2000 fall 3 weight 20
#server webhost02_8001 192.168.32.214:8001 check inter 2000 fall 3 weight 20 backend appserver_8082
mode http
balance roundrobin
server apphost01_8082 192.168.32.215:8082 check inter 2000 fall 3 先匹配到/images 就不会继续往下匹配 frontend web_service
bind *:80 acl api_req path_beg -i /api
use_backend appserver_8082 if api_req
acl url_static path_end .html .gif .png .jpg .css .js
use_backend webserver_8001 if url_static acl image_req path_beg -i /images
use_backend imageserver_8001 if image_req backend imageserver_8001
mode http
balance roundrobin
server webhost01_8001 192.168.32.76:8001 check inter 2000 fall 3 weight 20 backend webserver_8001
mode http
balance roundrobin
server webhost01_8001 192.168.32.213:8001 check inter 2000 fall 3 weight 20
#server webhost02_8001 192.168.32.214:8001 check inter 2000 fall 3 weight 20 backend appserver_8082
mode http
balance roundrobin
server apphost01_8082 192.168.32.215:8082 check inter 2000 fall 3 这样情况 http://www.zjtest7.com/images/3.png 就访问不到了,因为先匹配了path_end
												

haproxy image跳转 haproxy匹配 匹配到了就停止,不会继续往下匹配的更多相关文章

  1. Haproxy 重定向跳转设置 - 运维小结

    前面已经详细介绍了Haproxy基础知识 , 今天这里再赘述下Haproxy的重定向跳转的设置.  haproxy利用acl来实现haproxy动静分离,然而在许多运维应用环境中,可能需要将访问的站点 ...

  2. js进阶正则表达式9量词2(^和&作用:/^HTML5$/g匹配不到aHTML5b中的HTML5,不然是可以匹配到的)(/\d+(?=cm)/g)((?!cm))

    js进阶正则表达式9量词2(^和&作用:/^HTML5$/g匹配不到aHTML5b中的HTML5,不然是可以匹配到的)(/\d+(?=cm)/g)((?!cm)) 一.总结 ^和&作用 ...

  3. 多个haproxy 之间跳转

    C:\>ping wechatTest.winfae.com 正在 Ping wechatTest.winfae.com [120.55.118.6] 具有 32 字节的数据: 来自 120.5 ...

  4. haproxy /admin跳转 不会在接口上再次加上admin

    http://www.xx.com/admin/api/menu [root@wx03 mojo]# cat test.pl use Mojolicious::Lite; use JSON qw/en ...

  5. 在ibatis下匹配特殊手机号码(oracle数据库)

    <isNotNull prepend="AND" property="endNumber"> <isNotEmpty property=&qu ...

  6. 请实现一个函数用来匹配包括'.'和'*'的正则表达式。模式中的字符'.'表示任意一个字符,而'*'表示它前面的字符可以出现任意次(包含0次)。 在本题中,匹配是指字符串的所有字符匹配整个模式。例如,字符串"aaa"与模式"a.a"和"ab*ac*a"匹配,但是与"aa.a"和"ab*a"均不匹配

    // test20.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include<iostream> #include< ...

  7. haproxy笔记之三:配置HAProxy详细介绍

    2.1 配置文件格式 HAProxy的配置处理3类来主要参数来源:——最优先处理的命令行参数,——“global”配置段,用于设定全局配置参数:——proxy相关配置段,如“defaults”.“li ...

  8. haproxy笔记之二:HAProxy简介

    HAProxy提供高可用性.负载均衡以及基于TCP和HTTP应用的代理,支持虚拟主机,它是免费.快速并且可靠的一种解决方案.HAProxy特别适用于那些负载特大的web站点,这些站点通常又需要会话保持 ...

  9. 【VS2019】F12跳转到源码,关闭浏览器不停止项目【转】

    [VS2019]F12跳转到源码 1.工具->选项 2.文本编辑器->C#->高级->勾选支持导航到反编译源码 3.关闭浏览器不停止项目

随机推荐

  1. 优盘文件系统(FOR C)

    优盘上的数据按照其不同的特点和作用大致可分为5 部分:MBR 区.DBR 区.FAT 区.FDT区和DATA 区. 主引导记录(MBR) 绝对扇区号为:MBR_LBA=0x00000000 处是主引导 ...

  2. WinForm 鼠标进入移开窗体事件,因子控件导致的误触发

    /// <summary> /// 重写OnControlAdded方法,为每个子控件添加MouseLeave事件 /// </summary> /// <param n ...

  3. Fragment销毁时replace和add两个方法的区别

    这个首先从一个bug说起,如图:   我们都知道fragment切换有两种方式: 1. replace方式 transaction.replace(R.id.content, IndexFragmen ...

  4. JDBC的使用——Statement

    JDBC是Java最基本的数据库操作途径,虽然现在有了更高端的Hibernate和JPA,但是其实它们的底层还是用的这些最基本的JDBC.而且,如果开发一个小型的应用程序,使用Hibernate不免有 ...

  5. Family Tree

    Question A traditional constructing tree problem. Given a string to represent relationships, and pri ...

  6. BFS visit tree

    There are two ways to conduct BFS on tree. Solution 1 -- Given level Use recursion to find given lev ...

  7. Climbing Stairs 解答

    Question You are climbing a stair case. It takes n steps to reach to the top. Each time you can eith ...

  8. HDU1754(线段树)

    I Hate It Time Limit: 9000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total S ...

  9. jar 查找多jar包中类的办法

    jar -tf 多个文件列表, 如jar -tf *.jar 或  jar -tf   a.jar  b.jar ,这样是无任何输出的. 解决办法为: find  . -name  "*.j ...

  10. QUARTZ CRON

    本文来自:http://www.blogjava.net/crazycy/archive/2013/06/06/400287.html 每次使用Quartz Cron的时候都要去查manual doc ...