9951 explained code solutions for 126 technologies


nginx-luaHow to get global variable


init_by_lua_block {
  author = 'OLH'
}

server {
  location / {
    content_by_lua_block {
      ngx.say(author);
    }
  }
}ctrl + c
init_by_lua_block

nginx-lua module directive to run specified Lua code on server startup

author

this variable can be accessed globally

content_by_lua_block

nginx-lua module directive to specify block of Lua code

ngx.say

output given text to client