nginx proxy_pass
来源:互联网 发布:网络不安全的原因 编辑:程序博客网 时间:2024/04/30 09:51
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;
{
proxy_cache js_cache;
proxy_set_header Host js.test.com;
rewrite /static_js/(.+)$ /$1 break;
proxy_pass http://js.test.com;
}
0 0
- nginx proxy_pass
- Nginx配置proxy_pass
- nginx proxy_pass 里的”/”
- Nginx配置proxy_pass
- Nginx配置proxy_pass
- Nginx的proxy_pass配置
- Nginx配置proxy_pass
- nginx 之 proxy_pass详解
- Nginx配置基础-proxy_pass
- nginx > proxy_pass : upstream
- nginx proxy_pass 反向代理
- 【nginx】nginx proxy_pass指令"/"注意事项
- nginx location节点 proxy_pass 中的”/”
- nginx proxy_pass末尾神奇的/
- nginx配置proxy_pass代理转发
- nginx 代理 proxy_pass /etc/hosts
- 【Nginx】关于域名转发proxy_pass
- 转载:nginx proxy_pass 里的”/”
- 解决Presenting view controllers on detached view controllers is discouraged <PersonInfoViewControlle警告
- JBoss EAP 中LOG的配置
- adb 常用指令 !
- nginx 配置详解
- 最近用VB编程
- nginx proxy_pass
- ORACLE分页查询SQL语法——最高效的分页
- Caffe架构之GoogleNte模型
- Android中使用Retrofit库进行Http通讯
- Linux 安装 rz
- C/C++动态分配与释放内存的区别详细解析
- BestCoder Round #68 (div.1) B 矩阵乘法优化DP
- VMware非正常关闭,导致无法获取虚拟机所有权的解决办法
- MySQL并发复制系列二:多线程复制