"proxy_pass" cannot have URI part in location given by regular expression
在windows中使用nginx时报错:
C:\TDDOWNLOAD\nginx-1.6.0\nginx-1.6.0>nginx.exe -s reload
nginx: [emerg] "proxy_pass" cannot have URI part in location given by regular expression, or inside named location, or inside "if" statement, or insid
e "limit_except" block in C:\TDDOWNLOAD\nginx-1.6.0\nginx-1.6.0/conf/nginx.conf:61
我的nginx配置如下:
location ~* \.(jsp|do)$ { index index.jsp; proxy_pass http://localhost:8080/shop_goods; proxy_set_header X-Real-IP $remote_addr; }
为什么会报错呢?
因为location 使用了正则表达式(\.(jsp|do)$),而且proxy_pass中包含了URI part(shop_goods).错误提示的意思是:
如果location包含了正则表达式,则 "proxy_pass"不能包含URI part(shop_goods).
找到原因后,修改如下:
location ~* \.(jsp|do)$ { index index.jsp; proxy_pass http://localhost:8080; proxy_set_header X-Real-IP $remote_addr; }
注意:proxy_pass的值后面不要有斜杠,下面的是错误的:
proxy_pass http://localhost:8080/;
参考:http://huangkunlun520.blog.51cto.com/2562772/901974
nginx windows 安装包见附件
相关推荐
houjinkai 2020-03-01
xiaouncle 2020-01-23
gaoyubotaili 2014-06-18
心丨悦 2019-12-24
luofuIT成长记录 2019-12-15
Lincain 2019-11-16
killmice 2016-07-14
GoAheadY 2011-07-18
RickyHuo成长之路 2012-06-20
xiyf0 2018-05-30
yongzhang 2019-05-24
AbitGo 2019-04-12
haoxun0 2019-04-12
loveyy 2018-04-16
finnaxu 2016-04-29
87921432 2016-03-15
GimmeS 2016-03-01
LiTOPPPP 2015-06-09
QAnyang 2013-10-08