nginx proxy_pass

  

 

  1. proxy_pass可以实现URL路径的替换,跟alias很像
    proxy_pass,不带 "/" 时,只代理域名,URI(包括query_string)不改变,URI直接附加到proxy_pass指定的域名
    proxy_pass,后跟 "/" 时,会把location匹配的部分完全删除后,附加于proxy_pass后

     

     

     

     /vod 被保存


     

     

     

     /vod被删除

    server {
        location /vod {
            proxy_pass http://rear:8080;
        }
    }
    
    http://domain/vod/b.html => http://rear:8080/vod./b.html
    
    server {
        location /vod {
            proxy_pass http://rear:8080/;
        }
    }
    
    http://domain/vod/b.html => http:rear:8080/b.html
    
    server {
        location /vod {
            proxy_pass http://rear:8080/edu;
        }
    }
    
    http://domain/vod/b.html => http:rear:8080/edu/b.html
    
    server {
        location /vod/ {
            proxy_pass http://rear:8080/edu;
        }
    }
    
    http://domain/vod/b.html => http:rear:8080/edub.html  # usually a mistake

     

     

posted @ 2020-12-06 13:30  ascertain  阅读(95)  评论(0编辑  收藏  举报