【Nginx】错误: [emerg] “proxy_pass“ cannot have URI part in location given by regular expression,...

前言

  • nginx 1.15.11(下面的代码在此版本测试通过)
  • win10
  • phpstudy 8.1.1.3

错误

nginx: [emerg] "proxy_pass" cannot have URI part 
in location given by regular expression, 
or inside named location, 
or inside "if" statement, 
or inside "limit_except" block 
in D:\sde\phpstudy_pro\Extensions\Nginx1.15.11/conf/vhosts/com.3jcf.school-test.conf:53

错误写法

location ~* ^/index.html {
	if ($query_string ~ ".*(?:^|\?|&)method=autoGenerateIndex(?:(?:&.*)|$)") {
		proxy_pass http://127.0.0.1:1011/;
		break;
	}
}

正确写法

location ~* ^/index.html {
	if ($query_string ~ ".*(?:^|\?|&)method=autoGenerateIndex(?:(?:&.*)|$)") {
		proxy_pass http://127.0.0.1:1011;
		break;
	}
}

proxy_pass http://127.0.0.1:1011/; 改为 proxy_pass http://127.0.0.1:1011;。因为,在if语句中 cannot have URI part

上一篇:窗体内查找webbrowser控件的句柄


下一篇:Charles抓包(iOS的http/https请求)