码迷,mamicode.com
首页 > 其他好文 > 详细

nginx下Lua安装

时间:2015-04-05 23:33:27      阅读:217      评论:0      收藏:0      [点我收藏+]

标签:

--准备工作(下载)

LuaJIT-2.0.3.tar.gz

ngx_devel_kit

nginx_lua_module

nginx-1.4.7



(1)安装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)安装Nginx
cd nginx-1.4.7
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.35 --with-zlib=/usr/local/src/zlib-1.2.8 --add-module=/usr/local/src/ngx_devel_kit --add-module=/usr/local/src/lua-nginx-module
make
make install


(3)测试
/usr/local/nginx/sbin/nginx -t
会报错:error while loading shared libraries: libluajit-5.1.so.2: cannot open shared object file: No such file or directory
--添加变量
cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
echo "/usr/local/lib" >> /etc/ld.so.conf
ldconfig


(4)修改nginx.conf配置文件
server加入:
        location /hello {
           default_type‘text/plain‘;
           content_by_lua‘ngx.say("Hello Lua!")‘;
        }


(5)访问出现
Hello Lua!

nginx下Lua安装

标签:

原文地址:http://blog.csdn.net/pa5201314/article/details/44892865

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!