nginx: [emerg] unknown directive "if($request_method"
nginx: [emerg] unknown directive "if($request_method"
nginx报错
nginx: [emerg] unknown directive "if($request_method" in
...Nginx1.15.11/conf/vhosts/test.com_80.conf:11
nginx配置文件
10 location / {
11 if($request_method = OPTIONS){
12 add_header Access-Control-Allow-Origin "*";
报错原因
第11行:if 和 ( 缺一个空格 ,如果没有空格他把if($request_uri当成一个指令了,没有这个指令
修改:第11行if后加1个空格
10 location / {
11 if ($request_method = OPTIONS){
12 add_header Access-Control-Allow-Origin "*";