nginx: unknown directive $request_method

I need to get action from request in nginx.conf, while I wrote

if($request_method = GET){
   ...
}

I got unknown directive $request_method.

Also for regex in location

    location ~* /(?<var>([^/]*))/{
      if($var = something)
    }

I got unknown directive $var. I tried to config pcre libray when build library from source –with-pcre=path, but still not working.


Source: regex

Leave a Reply