Archived
1
0
a sandboxed Lua backend for FastCGI
This repository has been archived on 2021-02-02. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
Christopher Ramey 76d187e568 Switched to mmap for loading files. Added POST variable handling. Added
sandboxed loadstring, loadfile and  dofile functions for Lua. Fixed bug
where errors generated during request parsing may cause memory leaks
on certain platforms. Fixed bug where non-string errors generated by
Lua would cause a segmentation fault. Corrected various typos and
unclear code comments.
2012-05-21 17:09:41 +00:00
src Switched to mmap for loading files. Added POST variable handling. Added 2012-05-21 17:09:41 +00:00
.gitignore Squash merge into master branch 2012-02-26 23:51:24 +00:00
LICENCE Switched to mmap for loading files. Added POST variable handling. Added 2012-05-21 17:09:41 +00:00
lua-fastcgi.lua Switched to mmap for loading files. Added POST variable handling. Added 2012-05-21 17:09:41 +00:00
Makefile Switched to mmap for loading files. Added POST variable handling. Added 2012-05-21 17:09:41 +00:00
README.md Switched to mmap for loading files. Added POST variable handling. Added 2012-05-21 17:09:41 +00:00
TODO Switched to mmap for loading files. Added POST variable handling. Added 2012-05-21 17:09:41 +00:00

lua-fastcgi

lua-fastcgi is a sandboxed Lua backend for FastCGI. That is, you can write Lua scripts that serve up web pages. Options exist in lua-fastcgi.lua to configure a fixed amount of memory, cpu usage, and output bytes for each request. While sandboxed, lua-fastcgi supports a limited set of functions. If sandboxing is disabled, lua-fastcgi loads the standard libraries and users may load modules as needed.

compiling

lua-fastcgi requires libfcgi and liblua to successfully compile. lua-fastcgi has been tested under Linux, specifically Ubuntu 10.10. Other versions of Ubuntu will likely work without any changes. Other flavors of Linux should work with little to no effort. Other Unix-like operating systems are untested and unsupported, for now.

running

lua-fastcgi reads lua-fastcgi.lua in the current working directory. If it fails to read this file, it will assume certain defaults and continue anyway. Configuration defaults are documented in the included lua-fastcgi.lua file.

lua-fastcgi has been tested with nginx, but will likely work with other FastCGI compatible web servers with little effort. lua-fastcgi relies only on SCRIPT_NAME and SCRIPT_FILENAME FastCGI variables passed to it. Lua scripts can be configured inside of an nginx server directive as follows:

location ~* \.lua$ {
    include /etc/nginx/fastcgi_params;
    fastcgi_pass 127.0.0.1:9222;
}