Set directive is not allowed here

I am trying to follow this example here https://gist.github.com/morhekil/1ff0e902ed4de2adcb7a#file-nginx-conf but getting error-"set" directive is not allowed here

what am I doing wrong? Please note that I am using openresty and call nginx as-

nginx -p `pwd`/ -c conf/nginx.conf 

      

My nginx.conf context is the same as https://gist.github.com/morhekil/1ff0e902ed4de2adcb7a#file-nginx-conf

If I move the given variable to the server section, I no longer get this error except a new error

nginx: [emerg] unknown "resp_body" variable

      

+5


source to share


1 answer


A few months later, the answer comes :)

Github config file seems to be wrong. The directive is set

used in blocks server

, location

and if

.

Syntax: set the value of the variable $; Default: -
Context: server, location if



http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#set

Good luck!

+16


source







All Articles