9951 explained code solutions for 126 technologies


nginx-luaHow to set content type


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

nginx-lua module directive to specify block of Lua code

ngx.header

allows to set response headers

Content-type

response header to set

text/html

set content type to text/html

ngx.say

output given text to client