博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
nginx安装lua模块
阅读量:3942 次
发布时间:2019-05-24

本文共 3156 字,大约阅读时间需要 10 分钟。

在这里插入图片描述
在这里插入图片描述
lua安装

wget  http://www.lua.org/ftp/lua-5.3.5.tar.gztar -xf lua-5.3.5.tar.gzcd lua-5.3.4/make linux testmake install

在这里插入图片描述

在这里插入图片描述

wget http://luajit.org/download/LuaJIT-2.0.5.tar.gztar -xf LuaJIT-2.0.5.tar.gzcd LuaJIT-2.0.5/makemake install PREFIX=/usr/local/LuaJIT

在这里插入图片描述

NDK(nginx development kit)模块是一个拓展nginx服务器核心功能的模块,第三方模块开发可以基于它来快速实现。 NDK提供函数和宏处理一些基本任务,减轻第三方模块开发的代码量。

wget https://github.com/simplresty/ngx_devel_kit/archive/v0.3.1.tar.gzwget https://github.com/openresty/lua-nginx-module/archive/v0.10.15.tar.gzcd /usr/local/nginx/moduletar -xf v0.3.1.tar.gztar -xf v0.10.15.tar.gz

添加设置luaJit的环境变量(如果这一步设置错误会报错:/configure: error: ngx_http_lua_module requires the Lua library.)

在这里插入图片描述

export LUAJIT_INC=/usr/local/LuaJIT/include/luajit-2.0						#路径是上面luajit实际安装路径,路径错误安装lua模块时会报错很早不到luajit库export LUAJIT_LIB=/usr/local/LuaJIT/lib

预编译:

通过nginx -V获取之前预编译参数,并增加 --add-module参数

yum -y install lua-develcd /root/nginx-1.8.1./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-threads --user=www --group=www --add-module=/usr/local/nginx/module/echo-nginx-module-0.61 --add-module=/usr/local/nginx/module/lua-ssl-nginx-module-0.01rc3 --add-module=/usr/local/nginx/module/xss-nginx-module-0.06 --add-module=/usr/local/nginx/module/nginx-eval-module-2016.06.10 --add-module=/usr/local/nginx/module/ngx_devel_kit-0.3.1 --add-module=/usr/local/nginx/module/lua-nginx-module-0.10.15
# 编译器./configure > --prefix=/usr/local/nginx > --with-http_ssl_module > --with-http_realip_module > --with-http_addition_module > --with-http_sub_module > --with-http_dav_module > --with-http_flv_module > --with-http_mp4_module > --with-http_gunzip_module > --with-http_gzip_static_module > --with-http_auth_request_module > --with-http_random_index_module > --with-http_secure_link_module > --with-http_degradation_module > --with-http_stub_status_module > --with-mail --with-mail_ssl_module > --with-threads > --user=www > --group=www > --add-module=/usr/local/nginx/module/echo-nginx-module-0.61 > --add-module=/usr/local/nginx/module/lua-ssl-nginx-module-0.01rc3 > --add-module=/usr/local/nginx/module/xss-nginx-module-0.06 > --add-module=/usr/local/nginx/module/nginx-eval-module-2016.06.10 > --add-module=/usr/local/nginx/module/ngx_devel_kit-0.3.1 > --add-module=/usr/local/nginx/module/lua-nginx-module-0.10.15
make && make install

在这里插入图片描述

cd objs/cp /usr/local/nginx/sbin/nginx /usr/local/sbin/nginx.bakcp nginx /usr/local/nginx/sbin/nginx

在这里插入图片描述

vim /etc/ld.so.conf.d/usr_local_lib.conf/usr/loca/lib/usr/local/LuaJIT/libldconfigvim /usr/local/nginx/conf/nginx.confhttp{
... lua_package_cpath '/usr/local/LuaJIT/lib/lua/5.1/?.so;;'; lua_package_path '/usr/local/LuaJIT/share/luajit-2.0.5/resty/?.lua;;'; ... server{
... }}
nginx -s reloadnginx -V

转载地址:http://nmnwi.baihongyu.com/

你可能感兴趣的文章
JS moveStart和moveEnd方法
查看>>
thrift的lua实现
查看>>
编写高性能的Lua代码
查看>>
Python正则表达式指南
查看>>
LUA--thrift--lib库的创建生成
查看>>
Shell开启扩展模式匹配shopt -s extglob
查看>>
浅谈 URI 及其转义
查看>>
nginx 优化
查看>>
openresty+lua在反向代理服务中的玩法
查看>>
ClickHouse集群搭建从0到1
查看>>
nginx实现请求的负载均衡 + keepalived实现nginx的高可用
查看>>
linux shell 中数组的定义和for循环遍历的方法
查看>>
求1!+2!+3!....+20!(java代码)
查看>>
VMware安装Ubuntu系统无法选择语言
查看>>
QT5.12安装
查看>>
Git/Github初步使用记录
查看>>
QT 开发问题合集
查看>>
Github使用问题合集
查看>>
QT多线程服务器
查看>>
Ubuntu 18.04.2 ulimit配置
查看>>