Lua Wsapi

lua-users home
wiki

如何讓 Apache 和 Lua wsapi 運作

(至少在 Ubuntu 伺服器上)

Andrew Armstrong 2011 andrewa@archonix.co.uk

v0.1

1) 安裝一些基本的前置需求

apt-get install libreadline-dev build-essential unzip

2) 安裝 Apache 和 Fast cgi

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

3) 安裝 LuaRocks

apt-get install luarocks

4) 使用 LuaRocks 安裝

luarocks install wsapi-fcgi CFLAGS=-fPIC

luarocks install cgilua

5) 啟用 Apache 模組

a2enmod fcgid

6) 編輯你的網站

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

完成時,/var/www 輸入項目應該如下所示

<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
</IfModule?>
</Directory>

9) 修改你的 /var/www .htaccess 檔案

Options +ExecCGI DirectoryIndex? index.lp

10) 如果使用 MySQL,請安裝 mysql 開發標頭

apt-get install libmysqlclient-dev

11) 然後…安裝 luasql 模組,你需要包含目錄

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


RecentChanges · 偏好設定
編輯 · 歷程
上次編輯時間:2011 年 5 月 4 日下午 5:49 GMT (diff)