微信搜索superit|邀请体验:大数据, 数据管理、OLAP分析与可视化平台 | 赞助作者:赞助作者

nginx新添加lua模块

nginx aide_941 25℃

nginx新添加lua模块

 版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_39239779/article/details/77993811

一 、安装LuaJit
1.下载LuaJit  http://luajit.org/download.html

[root@iZ2zee0vc0e1cmmg48yawtZ src]# wget http://luajit.org/download/LuaJIT-2.0.5.tar.gz

2.安装
2.1解压:
[root@iZ2zee0vc0e1cmmg48yawtZ src]# tar xzvf LuaJIT-2.0.5.tar.gz
2.2进入解压目录
[root@iZ2zee0vc0e1cmmg48yawtZ src]# cd LuaJIT-2.0.5
2.3编译
[root@iZ2zee0vc0e1cmmg48yawtZ LuaJIT-2.0.5]# make PREFIX=/usr/local/luajit
2.4完成安装
[root@iZ2zee0vc0e1cmmg48yawtZ LuaJIT-2.0.5]# make install PREFIX=/usr/local/luajit

二、下载 ngx_devel_kit (NDK)   https://github.com/simpl/ngx_devel_kit/tags

1.[root@iZ2zee0vc0e1cmmg48yawtZ src]# wget https://github.com/simpl/ngx_devel_kit/archive/v0.3.0.tar.gz

2. [root@iZ2zee0vc0e1cmmg48yawtZ src]# tar xzvf v0.3.0.tar.gz
三、下载 ngx_lua  https://github.com/openresty/lua-nginx-module/tags

1.  [root@iZ2zee0vc0e1cmmg48yawtZ src]# wget https://github.com/openresty/lua-nginx-module/archive/v0.10.10.tar.gz

2. [root@iZ2zee0vc0e1cmmg48yawtZ src]# tar xzvf v0.10.10.tar.gz
四、查看之前编译参数

nginx -V
–prefix=/usr/local/nginx –user=www –group=www –with-openssl=/data/soft/openssl-1.0.2l –with-pcre=/data/soft/pcre-8.41 –with-zlib=/data/soft/zlib-1.2.8–with-http_ssl_module –with-http_stub_status_module –with-http_realip_module –with-http_gzip_static_module –with-http_flv_module

五、集成

[root@iZ2zee0vc0e1cmmg48yawtZ luajit]# export LUAJIT_LIB=/usr/local/luajit/lib

[root@iZ2zee0vc0e1cmmg48yawtZ luajit]# export LUAJIT_INC=/usr/local/luajit/include/luajit-2.0

./configure –prefix=/usr/local/nginx –user=www –group=www –with-openssl=/data/soft/openssl-1.0.2l –with-pcre=/data/soft/pcre-8.41 –with-zlib=/data/soft/zlib-1.2.8–with-http_ssl_module –with-http_stub_status_module –with-http_realip_module –with-http_gzip_static_module –with-http_flv_module–with-ld-opt=-Wl,-rpath,/usr/local/luajit/lib –add-module=/data/soft/ngx_devel_kit-0.3.0/ –add-module=/data/soft/lua-nginx-module-0.10.10/
注意:openssl-1.1.0和lua不兼容
make
cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak备份以前nginx
service nginx stop
cp objs/nginx /usr/local/nginx/sbin/ y回车
service nginx start
nginx -V 检查模块是否添加上

六、添加LuaRestyRedisLibrary
git clone https://github.com/openresty/lua-resty-redis.git下载LuaRestyRedisLibrary
vim /usr/local/nginx/conf/nginx.conf
lua_package_path “/usr/local/src/lua-resty-redis/lib/?.lua;;”;#在http里添加

 版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_39239779/article/details/77993811

一 、安装LuaJit
1.下载LuaJit  http://luajit.org/download.html

[root@iZ2zee0vc0e1cmmg48yawtZ src]# wget http://luajit.org/download/LuaJIT-2.0.5.tar.gz

2.安装
2.1解压:
[root@iZ2zee0vc0e1cmmg48yawtZ src]# tar xzvf LuaJIT-2.0.5.tar.gz
2.2进入解压目录
[root@iZ2zee0vc0e1cmmg48yawtZ src]# cd LuaJIT-2.0.5
2.3编译
[root@iZ2zee0vc0e1cmmg48yawtZ LuaJIT-2.0.5]# make PREFIX=/usr/local/luajit
2.4完成安装
[root@iZ2zee0vc0e1cmmg48yawtZ LuaJIT-2.0.5]# make install PREFIX=/usr/local/luajit

二、下载 ngx_devel_kit (NDK)   https://github.com/simpl/ngx_devel_kit/tags

1.[root@iZ2zee0vc0e1cmmg48yawtZ src]# wget https://github.com/simpl/ngx_devel_kit/archive/v0.3.0.tar.gz

2. [root@iZ2zee0vc0e1cmmg48yawtZ src]# tar xzvf v0.3.0.tar.gz
三、下载 ngx_lua  https://github.com/openresty/lua-nginx-module/tags

1.  [root@iZ2zee0vc0e1cmmg48yawtZ src]# wget https://github.com/openresty/lua-nginx-module/archive/v0.10.10.tar.gz

2. [root@iZ2zee0vc0e1cmmg48yawtZ src]# tar xzvf v0.10.10.tar.gz
四、查看之前编译参数

nginx -V
–prefix=/usr/local/nginx –user=www –group=www –with-openssl=/data/soft/openssl-1.0.2l –with-pcre=/data/soft/pcre-8.41 –with-zlib=/data/soft/zlib-1.2.8–with-http_ssl_module –with-http_stub_status_module –with-http_realip_module –with-http_gzip_static_module –with-http_flv_module

五、集成

[root@iZ2zee0vc0e1cmmg48yawtZ luajit]# export LUAJIT_LIB=/usr/local/luajit/lib

[root@iZ2zee0vc0e1cmmg48yawtZ luajit]# export LUAJIT_INC=/usr/local/luajit/include/luajit-2.0

./configure –prefix=/usr/local/nginx –user=www –group=www –with-openssl=/data/soft/openssl-1.0.2l –with-pcre=/data/soft/pcre-8.41 –with-zlib=/data/soft/zlib-1.2.8–with-http_ssl_module –with-http_stub_status_module –with-http_realip_module –with-http_gzip_static_module –with-http_flv_module–with-ld-opt=-Wl,-rpath,/usr/local/luajit/lib –add-module=/data/soft/ngx_devel_kit-0.3.0/ –add-module=/data/soft/lua-nginx-module-0.10.10/
注意:openssl-1.1.0和lua不兼容
make
cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak备份以前nginx
service nginx stop
cp objs/nginx /usr/local/nginx/sbin/ y回车
service nginx start
nginx -V 检查模块是否添加上

六、添加LuaRestyRedisLibrary
git clone https://github.com/openresty/lua-resty-redis.git下载LuaRestyRedisLibrary
vim /usr/local/nginx/conf/nginx.conf
lua_package_path “/usr/local/src/lua-resty-redis/lib/?.lua;;”;#在http里添加

转载请注明:SuperIT » nginx新添加lua模块

喜欢 (0)or分享 (0)