怎么在Nginx中添加lua模块 –

2022年 7月 20日 发表评论
腾讯云正在大促:点击直达 阿里云超级红包:点击领取
免费/便宜/高性价比服务器汇总入口(已更新):点击这里了解

这期内容当中本站将会给大家带来有关怎么在Nginx中添加左上臂模块,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。

安装 lua

wgethttp://luajit.org/download/LuaJIT-2.0.5.tar.gz

tar-zxvfLuaJIT-2.0.5.tar.gz

cdLuaJIT-2.0.5

make installprefix=/usr/local/LuaJitetc/profile 加入

#lua

导出LuaJit _ LIB=/usr/local/LuaJit/LIB

导出LuaJit _ INC=/usr/local/LuaJit/include/LuaJit-2.0源etc/profile

下载 ngx_devel_kit 模块

wget https://github。com/simple/ngx _ dev _ kit/archive/v 0。3 .0 .焦油。gzndk(nginx开发工具包)模块是一个拓展nginx服务器核心功能的模块,第三方模块开发可以基于它来快速实现日本电波工业株式会社提供函数和宏处理一些基本任务,减轻第三方模块开发的代码量

下载 lua-nginx-module 模块

wget https://github。com/open resty/Lua-nginx-module/archive/v 0。10 .9 RC 7。焦油。gzlua-nginx-模块模块使服务器中能直接运行左上臂

查看原始编译

nginx-V如:

配置参数:-user=www-group=www-prefix=/usr/local/nginx-with-http _ stub _ status _ module-with-http _ SSL _ module-with-http _ gzip _ static _ module-with-http _ sub _ module-with-http _ v2 _ module

进入服务器原始目录:/configure-user=www-group=www-prefix=/usr/local/nginx-with-http _ stub _ status _ module-with-http _ SSL _ module-with-http _ gzip _ static _ module-with-http _ v2 _ module-add-module=/root/Lua-nginx-module-0。10 .9 RC 7/-add-module=/root/ngx _ dev _ kit-0。3 .0只制造,不执行进行安装。

编译报错应该就是左上臂环境变量不对。

nginx-V命令报错。/nginx :加载共享库3360 libluajit-5.1时出错。所以。2: cannotpensharedobjectfile : nuschfileordirectory

解决:

echo '/usr/local/LuaJit/lib '/etc/LD。所以。主配置文件

执行成功之后可以nginx -V查看,无报错即可。

把原来的服务器备份为nginx_old

cp objs/nginx到原来的服务器并覆盖。

在编译目录执行

升级Nginx 添加 lua 模块

测试:

服务器{

.

位置/lua{

default _ type ' text/html ';

' content_by_lua '

' ngx.say('你好“卢阿,”)

}

.

}上述就是本站为大家分享的怎么在Nginx中添加左上臂模块了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注本站。

小咸鱼

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: