欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 健康 > 美食 > nginx+lua 实现URL重定向(根据传入的参数条件)

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

2024/10/25 22:33:00 来源:https://blog.csdn.net/QIU176161650/article/details/140362123  浏览:    关键词: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

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com