zoukankan      html  css  js  c++  java
  • Nginx配置proxy_pass转发的/路径问题

    Nginx配置proxy_pass转发的/路径问题
    
    
    国内私募机构九鼎控股打造APP,来就送 20元现金领取地址:http://jdb.jiudingcapital.com/phone.html 内部邀请码:C8E245J (不写邀请码,没有现金送) 国内私募机构九鼎控股打造,九鼎投资是在全国股份转让系统挂牌的公众公司,股票代码为430719,为“中国PE第一股”,市值超1000亿元。 
    
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
     
    
    Nginx配置proxy_pass转发的/路径问题
    
    在nginx中配置proxy_pass时,如果是按照^~匹配路径时,要注意proxy_pass后的url最后的/,当加上了/,相当于是绝对根路径,则nginx不会把location中匹配的路径部分代理走;如果没有/,则会把匹配的路径部分也给代理走。
    
    location ^~ /static_js/  {  proxy_cache js_cache;  proxy_set_header Host js.test.com;  proxy_pass http://js.test.com/;  }
    
    如上面的配置,如果请求的url是http://servername/static_js/test.html 会被代理成http://js.test.com/test.html
    
    而如果这么配置
    
    location ^~ /static_js/  {  proxy_cache js_cache;  proxy_set_header Host js.test.com;  proxy_pass http://js.test.com;  }
    
    则会被代理到http://js.test.com/static_js/test.htm
    
    当然,我们可以用如下的rewrite来实现/的功能
    
    location ^~ /static_js/  {  proxy_cache js_cache;  proxy_set_header Host js.test.com;  rewrite /static_js/(.+)$ /$1 break;  proxy_pass http://js.test.com;  } 
  • 相关阅读:
    获取桌面路径
    Winform判断一个窗口是否以模态化方式打开
    Winform弹出子窗体
    Winform 窗体传值 利用委托 子窗体传值给父窗体
    GridView中小的应用
    GridView显示水平滚动条
    GridView中常用属性的设置
    将DevExpress GridView中的数据原样导出到Excel中
    DevExpress 16.2如何汉化
    C#使用NPOI导出Excel
  • 原文地址:https://www.cnblogs.com/archoncap/p/5528154.html
Copyright © 2011-2022 走看看