WEB视频自适应 maven bootstrap 微信直播 Markdown grails mysqli count vue原理 pmp教学视频 css获取最后一个元素 etc文件夹 cpm怎么计算 js数组截取前5个 oracle时间格式化 python练习题 python多线程 python中time python图形界面开发 python循环10次 python正则匹配空格 python读取字典 java入门教程 java中正则表达式 java方法 java字符串替换 java调用方法 java抛出自定义异常 linux系统教程 怪物猎人ol捏脸数据 影视后期软件 max电池容量 英雄联盟体验服转换器 linux定时任务 任意屏官网 磁芯大战 正则表达式数字 相册制作软件 保留两位小数的函数 qq浏览器全屏
当前位置: 首页 > 学习教程  > 编程语言

nginx: [emerg] “proxy_pass“ cannot have URI part in location given by regular expression, or inside

2020/7/24 9:58:12 文章标签:

参考SO: nginx ‘proxy_pass’ cannot have URI part in location?

使用下面的配置会出现上面的问题

location ~ ^/web/(project1|project2|project3)/$  {
	proxy_pass https://example.com/h5/;
}

原因:

nginx cannot process your desired URI part in the proxy_pass directive
because you’re within a named location (hence the error message). This
is because nginx is built in a modular fashion and each configuration
block is read in various stages by the various modules. So just
remember that you cannot have a URI within your proxy_pass directive
in the following cases:

Regular Expression Locations
Named Locations
if Blocks

解决方案

location ~ ^/web/(project1|project2|project3)/$  {
    rewrite ^/web/(.*) /h5/$1;
	proxy_pass https://example.com;
}

本文链接: http://www.dtmao.cc/news_show_50184.shtml

附件下载

相关教程

    暂无相关的数据...

共有条评论 网友评论

验证码: 看不清楚?