9951 explained code solutions for 126 technologies


nginx-luaGet hostname with Lua


server {
  location / {
    content_by_lua_block {
      ngx.say( ngx.var.host );
    }
  }
}ctrl + c
content_by_lua_block

nginx-lua module directive to specify block of Lua code

ngx.say

output given text to client

ngx.var

access Nginx variables

host

variable with hostname value