Welcome! Log In Create A New Profile

Advanced

Re: [Lua] "Hello, world!" from Lua file?

January 28, 2014 06:51AM
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.
Subject Author Posted

[Lua] "Hello, world!" from Lua file?

Shohreh January 27, 2014 08:14AM

Re: [Lua] "Hello, world!" from Lua file?

Jader H. Silva January 27, 2014 09:02AM

Re: [Lua] "Hello, world!" from Lua file?

Shohreh January 27, 2014 10:28AM

Re: [Lua] "Hello, world!" from Lua file?

Jader H. Silva January 27, 2014 11:50AM

Re: [Lua] "Hello, world!" from Lua file?

Yichun Zhang (agentzh) January 27, 2014 03:36PM

Re: [Lua] "Hello, world!" from Lua file?

Shohreh January 28, 2014 06:51AM

Re: [Lua] "Hello, world!" from Lua file?

Yichun Zhang (agentzh) January 28, 2014 03:20PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 240
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready