Re: Recommended solution to run Lua scripts with Nginx?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Recommended solution to run Lua scripts with Nginx?
- From: Peng Zhicheng <pengzhicheng1986@...>
- Date: 2014年1月04日 21:58:36 +0800
于 2014年1月3日 21:25, Gilles Ganault 写道:
On 2013年12月08日 00:46:30 +0100, Gilles Ganault
<gilles.ganault@free.fr> wrote:
I'm running Debian and Nginx on a Linux appliance, and would like to
use Lua for form validation to avoid the fat of PHP or Python.
I'm still not clear about what I should use to run basic web scripts
in Lua through Nginx.
Am I correct those are the options available?
1. Nginx + Lua
"You can install it from source by compiling the lua-nginx-module with
your existing Nginx. If you chose that path you will also need a Lua
interpreter. LuaJIT-2.0.0 is recommended."
http://blog.cloudflare.com/pushing-nginx-to-its-limit-with-lua
2. CGI
3. FastCGI
4. uWSGI
5. ngx_lua module (a.k.a. HttpLuaModule)
Which solution would you recommend, preferably without having to
recompile Nginx since this is for an ARM appliance?
Thank you.
I found the announcement of this very interesting and useful project[1][2],
which you might probably want to give it a try.
It is very tiny and _just wokrs_ out of the box. There is even a interactive
DIY tutorial[3] you can download and use, simple and easy to explore.
It also supports a server side script format called `Lua Server Page',
or lsp[4], which has a very similar syntax to the `Lua Pages'[5] of CGILua.
A simple lsp page looks like this (quoted from the makoserver website)
--------------------cut-----------------------
<?lsp local message="Hello World" ?>
<html>
<body>
<h1><?lsp=message?></h1>
</body>
</html>
--------------------cut-----------------------
Good luck!
----------------------------------------------
[1] http://lua-users.org/lists/lua-l/2013-05/msg00701.html
[2] http://makoserver.net/
[3] http://makoserver.net/documentation/manual/
[4] http://realtimelogic.com/products/lua-server-pages/
[5] http://keplerproject.github.io/cgilua/manual.html#templates