当前位置: 首页 > news >正文

nginx+lua 实现URL重定向(根据传入的参数条件)

程序版本说明

程序版本URL
nginx1.27.0https://nginx.org/download/nginx-1.27.0.tar.gz
ngx_devel_kitv0.3.3https://github.com/simpl/ngx_devel_kit/archive/v0.3.3.tar.gz
luajitv2.1https://github.com/openresty/luajit2/archive/refs/tags/v2.1-20240626.tar.gz
lua-nginx-modulev0.10.26https://github.com/openresty/lua-nginx-module/archive/v0.10.26.tar.gz
lua-resty-corev0.1.28https://github.com/openresty/lua-resty-core/archive/refs/tags/v0.1.28.tar.gz
lua-resty-lrucachev0.12https://github.com/openresty/lua-resty-lrucache/archive/refs/tags/v0.12.tar.gz
lua-resty-httpv0.17.2https://github.com/ledgetech/lua-resty-http/archive/refs/tags/v0.17.2.tar.gz
lua-cjson2.1.0.9https://github.com/openresty/lua-cjson/archive/refs/tags/2.1.0.9.tar.gz

安装Lua

从https://github.com/openresty/luajit2下载安装

# git clone https://github.com/openresty/luajit2.git
cd /root/soft
wget https://github.com/openresty/luajit2/archive/refs/tags/v2.1-20240626.tar.gz
tar -xzvf v2.1-20240626.tar.gz
cd luajit2-2.1-20240626
make && make install
ln -s /usr/local/lib/libluajit-5.1.so.2 /lib64/libluajit-5.1.so.2

添加环境变量

vim /etc/profile
#最后两行添加如下内容:
export LUAJIT_LIB=/usr/local/lib
export LUAJIT_INC=/usr/local/include/luajit-2.1
下载解压ngx_devel_kit
cd /root/soft
wget https://github.com/simpl/ngx_devel_kit/archive/v0.3.3.tar.gz
tar -xzvf v0.3.3.tar.gz
下载解压lua-nginx-module
cd /root/soft
wget https://github.com/openresty/lua-nginx-module/archive/v0.10.26.tar.gz
tar -xzvf v0.10.26.tar.gz
# lua-nginx-module-0.10.16 以后都需要 lua-resty-core和lua-resty-lrucache**
wget https://github.com/openresty/lua-resty-core/archive/refs/tags/v0.1.28.tar.gz
tar -xzvf v0.1.28.tar.gz
cd lua-resty-core-0.1.28
make && make install LUA_LIB_DIR=/usr/local/share/lua/5.1wget https://github.com/openresty/lua-resty-lrucache/archive/refs/tags/v0.12.tar.gz
tar -xzvf v0.12.tar.gz
cd lua-resty-lrucache-0.12
http://www.lryc.cn/news/399052.html

相关文章:

  • 算法学习笔记(8.4)-完全背包问题
  • C++catch (...)陈述
  • Redis实践
  • 【Lora模型推荐】Stable Diffusion创作具有玉石翡翠质感的图标设计
  • vscode 远程开发
  • 前端Vue组件化实践:打造灵活可维护的地址管理组件
  • 虚幻引擎ue5游戏运行界面白茫茫一片,怎么处理
  • 《代理选择与反爬虫策略探究:如何优化网络爬虫效率与稳定性》
  • Kotlin Flow 防抖 节流
  • Android Studio下载与安装
  • 【LC刷题】DAY24:122 55 45 1005
  • 从零开始的python学习生活2
  • 【并发编程】进程 线程 协程
  • Vue的生命周期函数有哪些?详细说明
  • 大语言模型应用--AI工程化落地
  • 我会什么开发技能
  • Run LoongArch64 Alpine VM on x86_64
  • 4层负载均衡和7层负载均衡
  • 前端Vue组件化实践:打造仿京东天猫商品属性选择器组件
  • 智慧城市3d数据可视化系统提升信息汇报的时效和精准度
  • Git 详解(原理、使用)
  • android11为开机动画添加铃声(语音)
  • 使用 Akshare 下载国内的期货(主力连续)、股票和指数的历史行情数据
  • 【React】Google 账号之个性化一键登录按钮功能
  • MySQL已经连接对应数据库,但mapper中表名仍报错
  • CentOS 7:停止更新后如何下载软件?
  • MySQL GROUP_CONCAT 函数详解与实战应用
  • MATLAB Gazebo联合仿真
  • Vue3 pdf.js将二进制文件流转成pdf预览
  • 【机器学习】逻辑回归的原理、应用与扩展