nginx安装lua/replace-filter-nginx-module
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nginx安装lua/replace-filter-nginx-module相关的知识,希望对你有一定的参考价值。
nginx加载lua和replace-filter-nginx-module模块
一、lua部分
首先下载和安装部分模块
1、下载安装LuaJIT
官网:http://luajit.org/
下载链接:http://luajit.org/download/LuaJIT-2.1.0-beta3.tar.gz
wget http://luajit.org/download/LuaJIT-2.1.0-beta3.tar.gz
tar zxvf LuaJIT-2.1.0-beta3.tar.gz
cd LuaJIT-2.1.0-beta3
make PREFIX=/usr/local/luajit-2.1
make install PREFIX=/usr/local/luajit-2.1
设置好环境变量
export LUAJIT_LIB=/usr/local/luajit-2.1/lib
export LUAJIT_INC=/usr/local/luajit-2.1/include/luajit-2.1
2、下载ngx_devel_kit
wget https://github.com/simplresty/ngx_devel_kit/archive/v0.3.1rc1.tar.gz
tar zxvf v0.3.1rc1.tar.gz
3、下载lua-nginx-module
wget https://github.com/openresty/lua-nginx-module/archive/v0.10.12rc2.tar.gz
tar zxvf v0.10.12rc2.tar.gz
4、下载安装sregex
wget https://github.com/openresty/sregex/archive/v0.0.1.tar.gz
cd sregex-0.0.1
make
make install
需要做软链
ln -s /usr/local/lib/libsregex.so.0.0.1 /usr/lib64/libsregex.so.0
ln -s /usr/local/lib/libsregex.so.0.0.1 /usr/lib/libsregex.so.0
否则报错:
/usr/local/nginx/sbin/nginx: error while loading shared libraries: libsregex.so.0: cannot open shared object file: No such file or directory
5、下载replace-filter-nginx-module
wget https://github.com/openresty/replace-filter-nginx-module/archive/v0.01rc5.tar.gz
tar zxvf v0.01rc5.tar.gz
6、安装nginx加载以上模块
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module --add-module=../ngx_http_substitutions_filter_module-0.6.4/ --with-http_sub_module --add-module=../ngx_devel_kit-0.3.1rc1 --add-module=../lua-nginx-module-0.10.11 --with-ld-opt=-Wl,-rpath,/usr/local/luajit-2.1/lib --add-module=../replace-filter-nginx-module-0.01rc5/
make
make install
安装完毕
以上是关于nginx安装lua/replace-filter-nginx-module的主要内容,如果未能解决你的问题,请参考以下文章