9951 explained code solutions for 126 technologies


nginx-luaNginx Lua code example


server {
  location /hello {
    add_header Content-type text/plain;
    
    content_by_lua_block {
      ngx.say("Hello")
    }
  }
}ctrl + c
server {

virtual host configuration block

location

specific location (group of URLs) configuration

/hello {

handle all /hello... locations

add_header Content-type text/plain;

specify default content type for the content generated by Lua

content_by_lua_block

nginx-lua module directive to specify block of Lua code

ngx.say("Hello")

sample Lua code that prints Hello to the browser (online example)