Lua Wsapi

lua-users home

How to get apache and lua wsapi to work

(at least on a Ubuntu server)

Andrew Armstrong 2011


1) Install some basic pre-requisites:

apt-get install libreadline-dev build-essential unzip

2) Install Apache and Fast cgi:

apt-get install apache2 libfcgi libfcgi-dev libapache2-mod-fcgid

3) Install LuaRocks

apt-get install luarocks

4) With LuaRocks install:

luarocks install wsapi-fcgi CFLAGS=-fPIC

luarocks install cgilua

5) Enable apache module

a2enmod fcgid

6) Edit your site:

sudo gedit /etc/apache2/sites-enabled/000-default

The /var/www entry should look something like this when you are finished:

<Directory /var/www/>
Options FollowSymLinks? MultiViews?
# Indexes
AllowOverride? All
Order allow,deny
allow from all
<IfModule? mod_fcgid.c>
AddHandler? fcgid-script .lua
AddHandler? fcgid-script .lp
FCGIwrapper "/usr/local/bin/cgilua.fcgi" .lp
FCGIwrapper "/usr/local/bin/cgilua.fcgi" .lua

9) Modify your /var/www .htaccess file:

Options +ExecCGI DirectoryIndex? index.lp

10) If you use MySQL, install mysql development headers:

apt-get install libmysqlclient-dev

11) Then.... Install the luasql module, you need the include dir:

luarocks install luasql-mysql MYSQL_INCDIR=/usr/include/mysql CFLAGS=-fPIC

RecentChanges · preferences
edit · history
Last edited May 4, 2011 4:49 pm GMT (diff)