very simple question for most of you I suppose, but I can't find any answers. I don't know lua at all, I just need this for work :)
I have a line in my nginx.conf like so:
set_by_lua_file $instance_address conf/some_file.lua "user:";
What I need to do basically is set my variable instance_address
from my file some_file.lua
and also passing the variable user:*
for this example. Does this work ? Can I access the variable inside some_file.lua
then ? How ?
I've tried with $0
, $1
, arg[0]
and arg[1]
but it didn't work
Cheers !
If you want to pass some value to the lua script from nginx configuration, you can set some variable to the required value, eg
set $user "user:";
and then use it in the lua script via ngx.var.user
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.