Запуск Lua + Orbit + WSAPI + FASTCGI + Lighttpd на Ubuntu 7.10

Устанавливаем lua :

aptitude install lua5.1
aptitude install liblua5.1-dev

Устанавливаем luarocks :

wget http://luaforge.net/frs/download.php/3727/luarocks-1.0.tar.gz -P /tmp/
tar -zxf /tmp/luarocks-1.0.tar.gz -C /tmp/
cd /tmp/luarocks-1.0
./configure --with-lua-include=/usr/include/lua5.1 --prefix=/usr
make
make install

Устанавливаем модули lua :

aptitude install unzip
luarocks install orbit
aptitude install libfcgi
aptitude install libfcgi-dev
luarocks install wsapi-fcgi

Устанавливаем lighttpd :

aptitude install lighttpd

В файле /etc/lighttpd/lighttpd.conf разкомментировать:

# server.port               = 81

Перезапускаем lighttpd :

/etc/init.d/lighttpd restart

Создаем тестовое приложение :

mkdir /opt/orbit

Создаем файл /opt/orbit/test.lua :

#!/usr/bin/lua5.1

pcall(require,"luarocks.require")
local fastcgi = require"wsapi.fastcgi"
local app = require"hello"
fastcgi.run(app.run)

Создаем файл /opt/orbit/hello.lua :

require"orbit"
module("hello", package.seeall, orbit.new)

---------------------------------------------------------
-- HTTP
---------------------------------------------------------
function index(web)
        return "Hello world!!!"
end
---------------------------------------------------------
-- Mapping
---------------------------------------------------------
hello:dispatch_get(index, "/", "/index")

Задаем права :

chmod o+x,o+r /opt/orbit/*.lua

Конфигурируем lighttpd :

lighty-enable-mod fastcgi

Коментируем в /etc/lighttpd/conf-enabled/10-fastcgi.conf :

fastcgi.server    = ( ".php" =>
        ((
                "bin-path" => "/usr/bin/php-cgi",
                "socket" => "/tmp/php.socket",
                "max-procs" => 2,
                "idle-timeout" => 20,
                "bin-environment" => (
                        "PHP_FCGI_CHILDREN" => "4",
                        "PHP_FCGI_MAX_REQUESTS" => "10000"
                ),
                "bin-copy-environment" => (
                        "PATH", "SHELL", "USER"
                ),
                "broken-scriptfilename" => "enable"
        ))
)

Добавляем в /etc/lighttpd/conf-enabled/10-fastcgi.conf :

fastcgi.server = ( "/do" =>
    (( "socket" => "/tmp/lua.2.socket",
    "bin-path" => "/opt/orbit/test.lua",
    "check-local" => "disable",
    "broken-scriptfilename" => "enable",
    "min-procs" => 3,
    "max-procs" => 3 ))
)

Перезапускаем lighttpd :

/etc/init.d/lighttpd restart

При открытии http://localhost:81/do/ должно отобразится "Hello world!!!".