9951 explained code solutions for 126 technologies


nginx-luaHow to send HTML response


server {
  location / {
    content_by_lua_block {
      ngx.header["Content-type"] = 'text/html'
      ngx.say('<b>heya</b>')
    }
  }
}ctrl + c
content_by_lua_block

nginx-lua module directive to specify block of Lua code

ngx.header

allows to set response headers

text/html

set content type to text/html

ngx.say

output given text to client