9951 explained code solutions for 126 technologies


nginx-luaGet timestamp with Lua


server {
  location / {
    content_by_lua_block {
      local ts = os.time()
      ngx.say(ts)
    }
  }
}ctrl + c
content_by_lua_block

nginx-lua module directive to specify block of Lua code

os.time()

returns current unix timestamp in seconds

ngx.say

output given text to client