Yichun Zhang (agentzh) Wrote:
-------------------------------------------------------
> Alternatively one can set the Content-Type response header directly in Lua (which is more flexible):
>
> content_by_lua '
> ngx.header["Content-Type"] = "text/plain"
> ngx.say("hello world")
> ';
Thanks for the tip, it works. Is there a tutorial besides the following page about how to write Lua scripts through ngx_lua?
http://wiki.nginx.org/HttpLuaModule
One other thing: I'd like / to map to index.html which contains a form, and the Lua script should be called as the action to handle the form. How can I do this?
This calls the script any time I hit the root directory:
location / {
root html;
index index.html index.htm;
content_by_lua_file html/hello.lua;
#add_header Content-Type text/plain;
}
Thank you.