• haproxy image跳转 haproxy匹配 匹配到了就停止,不会继续往下匹配


    <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 


    
       
    
    
  • 相关阅读:
    微信小程序创建第一个项目
    微信小程序工具下载与安装
    Windows下删除顽固文件夹
    微信小程序账号注册
    C++第四十九篇 -- 将一个项目Copy到另一台电脑
    C++第四十八篇 -- 字符串分离方法
    C++第四十七篇 -- VS2017带参数启动调试程序
    MarkDown插入图片
    Http升级到Https (本地测试,无须域名和认证)
    语音识别(ASR) 阿里云
  • 原文地址:https://www.cnblogs.com/zhaoyangjian724/p/6199295.html
Copyright © 2020-2023  润新知