安装步骤:
1 安装 Luajit
# wegt
# tar zxvf LuaJIT-2.0.3.tar.gz
# cd LuaJIT-2.0.3
# make && make install
增加环境变量
#
export LUAJIT_LIB=/usr/local/lib
# export LUAJIT_INC=/usr/local/include/luajit-2.0
在编译nginx之前要执行下面一行,如果不执行,启动nginx将会出现 “error while loading shared libraries: libluajit-5.1.so.2: cannot open shared object file: No such file or directory”
# export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH
2 nginx_lua 模块
# wget https://codeload.github.com/simpl/ngx_devel_kit/tar.gz/v0.2.19
# tar zxvf v0.2.19
# wget
# tar zxvf v0.9.12
3 编译安装nginx1.6.2
# ./configure --prefix=/usr/local/nginx --with-http_gzip_static_module --with-http_ssl_module --add-module=/opt/ngx_devel_kit-0.2.19/ --add-module=/opt/lua-nginx-module-0.9.12
# make
# make install
4 验证
在nginx.conf中添加
location /hello {
default_type 'text/plain';
content_by_lua 'ngx.say("hello, lua")';
}
打开浏览器
出现“hello, lua" 说明安装正确
阅读(2512) | 评论(0) | 转发(0) |