本文共 1643 字,大约阅读时间需要 5 分钟。
nginx加载lua和replace-filter-nginx-module模块
一、lua部分首先下载和安装部分模块1、下载安装LuaJIT官网:下载链接:wget http://luajit.org/download/LuaJIT-2.1.0-beta3.tar.gztar zxvf LuaJIT-2.1.0-beta3.tar.gzcd LuaJIT-2.1.0-beta3make PREFIX=/usr/local/luajit-2.1 make install PREFIX=/usr/local/luajit-2.1
设置好环境变量
export LUAJIT_LIB=/usr/local/luajit-2.1/libexport 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.gztar zxvf v0.3.1rc1.tar.gz
3、下载lua-nginx-module
wget https://github.com/openresty/lua-nginx-module/archive/v0.10.12rc2.tar.gztar zxvf v0.10.12rc2.tar.gz
4、下载安装sregex
wget https://github.com/openresty/sregex/archive/v0.0.1.tar.gzcd sregex-0.0.1makemake install
需要做软链
ln -s /usr/local/lib/libsregex.so.0.0.1 /usr/lib64/libsregex.so.0ln -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.gztar 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/makemake install
安装完毕
转载于:https://blog.51cto.com/314258/2065311