1/3分步阅读
下载luajit.
解压,安装
tar -zxvf LuaJIT-2.0.3.tar.gz
cd LuaJIT-2.0.3
make
make install
因为安装在缺省路径,所以LuaJIT对应的lib,include均在/usr/local目录里。
修改环境变量
export LUAJIT_LIB=/usr/local/lib
export LUAJIT_INC=/usr/local/include/luajit-2.0
2/3
nginx_lua模块
下载ngx_devel_kit,nginx_lua_module解压
编译Nginx
cd nginx-1.2.9
./configure --prefix=/usr/local/nginx--with-openssl=/home/openssl-1.0.1e --with-pcre=/home/pcre-8.33--with-http_stub_status_module --with-zlib=/home/zlib-1.2.8--add-module=/home/nginx_lua/lua-nginx-module-0.9.7--add-module=/home/nginx_lua/ngx_devel_kit-0.2.19
make
make install
3/3
配置nginx.conf
修改nginx.conf配置文件
server加入
location /hello {
default_type'text/plain';
content_by_lua'ngx.say("hello, lua")';
}
保存
访问结果,如下图

注意事项
启动nginx会报 如下错误./sbin/nginx: error while loading shared libraries:libluajit-5.1.so.2: cannot open shared object fil