Your Lua script has to conform to the CGI spec, that is send a "Status:" header
line with the HTTP status, followed by other HTTP headers, followed by two DOS
style newlines, followed by your content.
print("Status: 200 OK\r\n\r\nHello, world!\r\n")
should do for a minimal script, but you really do want to use some sort of
framework to deal with form data parsing and so on.
This thread looks like it may be of interest to you.
http://lua-users.org/lists/lua-l/2008-09/msg00368.html
At quick glance, CGILua looks like it's some sort of equivalent to WSGI, and
thus probably overkill for your use.
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On
> Behalf Of Gilles
> Sent: 26. helmikuuta 2014 2:57
> To: [email protected]
> Subject: Re: [uWSGI] [CGI] Compiling + editing file
>
> On Tue, 25 Feb 2014 16:57:07 +0000, Aarni Koskela
> <[email protected]> wrote:
>
> >You're mixing up command-line configuration format (--option=value) with
> the INI format (option=value), and uWSGI is trying to read "cgi" as an INI.
> >
> >As your command line is growing, I'd heartily suggest making, say, myapp.ini
> with:
> >
> >[uwsgi]
> >http=:8000
> >http-modifier1=9
> >uid=nobody
> >gid=nogroup
> >check-static=/tmp/uwsgi-2.0/www
> >cgi=/tmp/uwsgi-2.0/cgi
> >cgi-allowed-ext=.lua
> >cgi-helper=.lua=lua
> >
> >and running uWSGI from here on out with
> >
> >./uwsgi myapp.ini
>
> Thanks much.
>
> I get this when calling cgi.lua:
> =========
> invalid CGI output !!!
> [pid: 3501|app: -1|req: -1/2] 192.168.0.1 () {32 vars in 558 bytes} [Wed Feb
> 26
> 01:51:09 2014] GET /cgi.lua => generated 0 bytes in 9 msecs (HTTP/1.1 500) 0
> headers in 0 bytes (0 switches on core 0) =========
>
> The wiki (http://uwsgi-docs.readthedocs.org/en/latest/CGI.html)
> doesn't show how to write CGI scripts in Lua, and the examples/ directory in
> the source doesn't seem to contain such scripts either.
>
> Would someone have a working Lua example so I can see what it looks like?
> Do I need to use eg. CGILua?
>
> Thank you.
>
> _______________________________________________
> uWSGI mailing list
> [email protected]
> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi