Linux搭建 nginx+lua环境

来源:互联网 发布:淘宝手机优惠券用 编辑:程序博客网 时间:2024/06/05 02:30

1.安装JIT

Lua:编译安装LuaJIT,第一个Lua程序

http://blog.csdn.net/xinteng2012/article/details/71088930

2.下载NDK与Lua_module


下载NDK,解压缩

https://github.com/simpl/ngx_devel_kit/releases

自己选择版本


下载Lua_module,解压缩

https://github.com/openresty/lua-nginx-module/releases

自己选择版本

3.编译安装Nginx

http://blog.csdn.net/xinteng2012/article/details/71088232


编译ndk和lua模块


./configure --prefix=/usr/local/nginx --add-module=../ngx_devel_kit-0.3.0/ --add-module=../lua-nginx-module-0.10.8/ 


4.验证Nginx是否链接了libluajit-5.1.so.2

ldd /usr/local/nginx/sbin/nginx | grep lua


5.测试lua

修改nginx.conf

location /test{                  content_by_lua '                          ngx.say("Hello world")                          ngx.log(ngx.ERR, "err err")';          }

curl http://localhost/test



0 1
原创粉丝点击