zoukankan      html  css  js  c++  java
  • nginx 之 proxy_pass详解

    在nginx中配置proxy_pass代理转发时,如果在proxy_pass后面的url加/,表示绝对根路径;如果没有/,表示相对路径,把匹配的路径部分也给代理走。
     
     
    假设下面四种情况分别用 http://192.168.1.1/proxy/test.html 进行访问。
     
     
    第一种:
    location /proxy/ {
        proxy_pass http://127.0.0.1/;
    }
    代理到URL:http://127.0.0.1/test.html
     
     
    第二种(相对于第一种,最后少一个 / )
    location /proxy/ {
        proxy_pass http://127.0.0.1;
    }
    代理到URL:http://127.0.0.1/proxy/test.html
     
     
    第三种:
    location /proxy/ {
        proxy_pass http://127.0.0.1/aaa/;
    }
    代理到URL:http://127.0.0.1/aaa/test.html
     
     
    第四种(相对于第三种,最后少一个 / )
    location /proxy/ {
        proxy_pass http://127.0.0.1/aaa;
    }
    代理到URL:http://127.0.0.1/aaatest.html

     

    转载

  • 相关阅读:
    线程阻塞工具:LockSupport
    jenkins
    Mysql中MVCC的使用及原理详解
    你知道 hash 的实现吗?为什么要这样实现?
    为什么哈希表的容量一定要是 2的整数次幂?
    同步异步 阻塞 非阻塞
    MFC
    MFC
    MFC
    MFC
  • 原文地址:https://www.cnblogs.com/lulin1/p/8202955.html
Copyright © 2011-2022 走看看