[uWSGI] Newbie question about uwsgi/uWSGI + Lua

Roberto De Ioris roberto at unbit.it
Tue Apr 22 07:44:38 CEST 2014


> On Thu, 16 Jan 2014 15:06:38 +0100, Gilles
> <codecomplete at free.fr> wrote:
>>Since the Nginx ngx_lua module is blocking and is, thus not
>>recommended for use with SQLite, I need to know if uwsgi/uWSGI is a
>>better alternative:
>
> I read the uwsgi-docs.pdf but didn't find how to run uwsgi as an HTTP
> server to support Lua scripts in CGI.
>
> =============== Compiling uwsgi on ARM:
>
> 1. Compiled uwsgi:
>
> UWSGICONFIG_LUAPC=luajit
> make lua cgi
>
> 2. Wrote a configuration file:
>
> ;myapp.ini
> [uwsgi]
> workdir = /tmp/uwsgi-2.0.3
> ipaddress = 192.168.0.10
>
> http = $(ipaddress):8080
> stats = $(ipaddress):9191
> processes = 4
> threads = 2
> uid=nobody
> gid=nogroup
> static-index = index.html, index.htm
> check-static=%(workdir)/www
> http-modifier1=9 ;lua
> cgi=%(workdir)/cgi
> cgi-allowed-ext=.lua
> cgi-helper=.lua=lua
>
> 3. Wrote a CGI script in Lua in /tmp/uwsgi-2.0.3/cgi
> ********
> print("Status: 200 OK\n")
> print("Content-Type: text/plain\n\n")
>
> print("Yes!")
> ********
>
> 4. Launched uwsgi
> ./uwsgi myapp.ini
>
> =============== Issues:
>
> 1. http://srv/  doesn't work: Looks like static-index above is wrong.
> Should I use another separator than a comma?
>
> 2. http://srv/cgi/ = Not found
>
> http://srv/cgi/test.lua = prints source code instead of running the
> script. Is it because of http-modifier?
>
> Thanks for any help.
>
> _______________________________________________
> uWSGI mailing list
> uWSGI at lists.unbit.it
> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
>

- you do not need to embed a lua engine to use CGIs (they work at another
level). The lua plugin exposes a wsapi interface. you do not need it

- middle/end line comment do not works in .ini

- placeholders use the %(var) syntax, the $(var) is for environment vars

- when you enable static file serving and you have plugin using real file
(like php or cgi) you need to tell the static engine to ignore those files
(for example using static-skip-ext)

[uwsgi]
http = :8080
http-modifier1 = 9
stats = :9191
processes = 4
threads = 2
uid = nobody
gid = nogroup
check-static = your_path
static-index = your_indexes
; force teh static engine to ignore .lua files
static-skip-ext = .lua
cgi = cgi-dirs
cgi-allowed-ext = .lua
cgi-helper = .lua=lua



-- 
Roberto De Ioris
http://unbit.it


More information about the uWSGI mailing list