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 "*";