最新消息:这里是最新消息

nginx添加lua支持

linux benty 596浏览 0评论

nginx编译安装文章

按照下面的流程,有问题可以到github下最新版1

cd /root
wget -c http://luajit.org/download/LuaJIT-2.0.4.tar.gz
tar zxf LuaJIT-2.0.4.tar.gz
cd LuaJIT-2.0.4
make
make install PREFIX=/usr/local/luajit
cd ..

wget -c https://github.com/openresty/lua-nginx-module/archive/v0.10.5.tar.gz
tar zxf v0.10.5.tar.gz

wget -c https://github.com/simpl/ngx_devel_kit/archive/v0.3.0.tar.gz
tar zxf v0.3.0.tar.gz

export LUAJIT_LIB=/usr/local/luajit/lib
export LUAJIT_INC=/usr/local/luajit/include/luajit-2.0

cat > /etc/ld.so.conf.d/luajit.conf<<EOF
/usr/local/luajit/lib
EOF

ldconfig

–with-ld-opt=-Wl,-rpath,/usr/local/luajit/lib –add-module=/usr/local/src/ngx_devel_kit-0.3.0 –add-module=/usr/local/src/lua-nginx-module-0.10.5

如果要安装ssl安装下面

wget https://www.openssl.org/source/openssl-1.0.2l.tar.gz

重新编译然后make


1、 LuaJIT

wget http://luajit.org/download/LuaJIT-2.0.2.tar.gz
tar -zxvf LuaJIT-2.0.2.tar.gz
cd LuaJIT-2.0.2
make install PREFIX=/usr/local/LuaJIT

export LUAJIT_LIB=/usr/local/LuaJIT/lib
export LUAJIT_INC=/usr/local/LuaJIT/include/luajit-2.0

2、 ngx_devel_kit和lua-nginx-module

cd /opt/download

wget https://github.com/simpl/ngx_devel_kit/archive/v0.3.0.tar.gz

wget https://github.com/openresty/lua-nginx-module/archive/v0.10.9rc7.tar.gz

# 分别解压

3、 重新编译Nginx

cd /opt/download

wget http://nginx.org/download/nginx-1.14.0.tar.gz
tar -zxvf nginx-1.14.0.tar.gz
cd nginx-1.14.0

./configure --add-module=/opt/download/ngx_devel_kit-0.3.0 --add-module=/opt/download/lua-nginx-module-0.10.9rc7

# 如若出现:
# error: the HTTP gzip module requires the zlib library.
# yum install zlib zlib-devel 一下即可
#自己安装的有不要覆盖就不要make install 
make -j 4 && make install

4、 加载lua库,加入到ld.so.conf文件

echo "/usr/local/LuaJIT/lib" >> /etc/ld.so.conf
# 然后执行如下命令:
ldconfig

5. 在vhost中加载配置

location /lua {
        default_type 'text/html';
        content_by_lua 'ngx.say("hello world")';
}

之后就可以安装网站防火墙nginx_lua_waf了

 

转载请注明:稻香的博客 » nginx添加lua支持

发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址