Lua 脚本
NGINX 可以通过 Lua 语言的脚本能力得到增强。 您无需使用 OpenResty。借助我们丰富的 Lua 库包集合, 您可以在一个地方获得更好的解决方案。
GetPageSpeed = NGINX Plus + OpenResty + Lua libraries
GetPageSpeed 提供了 Lua NGINX 模块和 Lua 库,以扩展 NGINX 的 Lua 脚本能力。
只需安装 nginx-module-lua 即可扩展 NGINX 的 Lua 脚本能力。 并且有 100 (!) 个 Lua 库可通过单独的易于安装的包获得。
请参阅下面的完整列表:
title: NGINX 的 Lua 库 - OpenResty Resty 包用于 RHEL 和 CentOS description: 在 RHEL、CentOS、Rocky Linux 和 Amazon Linux 上为 NGINX 和 OpenResty 安装 lua-resty-* 包。HTTP 客户端、Redis、MySQL、JWT、速率限制、缓存以及 80 多个 Lua 库作为 RPM 包。
NGINX 的 Lua 库
NGINX Lua 模块 使得在 NGINX 内部高性能地运行 Lua 脚本成为可能,而无需接触 C 代码。 GetPageSpeed 提供了一整套 lua-resty-* 库,作为可直接安装的 RPM 包。
NGINX Extras = NGINX Plus + OpenResty + Lua 库
通过企业级的打包和支持,获取 OpenResty 的强大功能。 安装 Lua 模块和库,以扩展 NGINX 的脚本能力。
可用的 Lua 库
| 软件包 | 说明 |
|---|---|
| lua-resty-acme | 自动 Let's Encrypt 证书服务和 ACMEv2 协议的 Lua 实现 |
| lua-resty-ada | LuaJIT FFI 绑定到 Ada — 符合 WHATWG 标准的快速 URL 解析器 |
| lua-resty-auto-ssl | 在nginx-module-lua/nginx内部使用Let's Encrypt进行即时(免费)SSL注册和续订 |
| lua-resty-aws-auth | 用于计算 AWS 签名 v4 授权头的 Lua resty 模块 |
| lua-resty-aws-sdk | 向aws服务发起api调用 |
| lua-resty-balancer | nginx-module-lua 的通用一致性哈希实现 |
| lua-resty-base-encoding | 比 base64 编码更快的替代方案,并为 nginx-module-lua 应用程序提供缺失的基本编码 |
| lua-resty-cache | Http 缓存到 redis,可以提供过期响应,并且使用 "lua-resty-lock" 只允许一个请求填充新的缓存 |
| lua-resty-checkups | 在纯 Lua 中管理 NGINX 上游 |
| lua-resty-consul | 与nginx-module-lua的consul HTTP API接口的库 |
| lua-resty-consul-event | Consul 事件 HTTP API 包装器 |
| lua-resty-core | 基于FFI的新API用于lua-nginx-module |
| lua-resty-cors | 这是在nginx-module-lua上实现CORS的工具 |
| lua-resty-counter | 无锁计数器用于nginx-module-lua |
| lua-resty-ctxdump | 存储并应用旧的 ngx.ctx,以避免在 NGINX 内部重定向发生后被销毁 |
| lua-resty-dns | nginx-module-lua 的 DNS 解析器 |
| lua-resty-dns-server | nginx-module-lua 的 Lua DNS 服务器驱动程序 |
| lua-resty-etcd | 非阻塞 Lua etcd 驱动库,用于 nginx-module-lua |
| lua-resty-exec | 在nginx-module-lua中运行外部程序,无需生成shell或阻塞 |
| lua-resty-feishu-auth | 适用于 nginx-module-lua 的基于飞书组织架构的登录认证 |
| lua-resty-fileinfo | LuaJIT FFI 绑定到 libmagic,魔术数字识别库 - 尝试确定文件类型 |
| lua-resty-ftpclient | 基于 cosocket API 的 nginx-module-lua 的 Lua ftp 客户端驱动程序 |
| lua-resty-global-throttle | 具有共享存储支持的一般用途流量控制 |
| lua-resty-healthcheck | 用于验证上游服务状态的nginx-module-lua健康检查库 |
| lua-resty-hmac | nginx-module-lua 和 LuaJIT 的 HMAC 函数 |
| lua-resty-hoedown | LuaJIT FFI 绑定到 Hoedown,一个符合标准、快速、安全的 C 语言 Markdown 处理库 |
| lua-resty-http | 用于nginx-module-lua的Lua HTTP客户端cosocket驱动程序 |
| lua-resty-http2 | nginx-module-lua 的 HTTP/2 协议(客户端)实现 |
| lua-resty-httpipe | 用于nginx-module-lua的Lua HTTP客户端cosocket驱动程序,接口更加灵活 |
| lua-resty-hyperscan | nginx-module-lua的Hyperscan |
| lua-resty-influx | 用于 InfluxDB 的 Nginx-module-lua 客户端 |
| lua-resty-ini | nginx-module-lua 的 Ini 解析器 |
| lua-resty-injection | LuaJIT FFI 绑定到 libinjection (https://github.com/client9/libinjection) |
| lua-resty-iputils | 用于在 nginx-module-lua 中处理 IP 地址的实用函数 |
| lua-resty-jit-uuid | 快速且无依赖的 LuaJIT/nginx-module-lua UUID 库 |
| lua-resty-jq | LuaJIT FFI 绑定到 jq |
| lua-resty-jsonrpc-batch | nginx-module-lua 的 JSONRPC 批处理协议模块 |
| lua-resty-jump-consistent-hash | nginx-module-lua的一致性哈希 |
| lua-resty-jwt | JWT 为伟大的 nginx-module-lua |
| lua-resty-jwt-verification | 带有 JWKS 集成的 nginx-module-lua 的 JWT 验证库 |
| lua-resty-kafka | 基于 cosocket API 的 nginx-module-lua 的 Lua kafka 客户端驱动程序 |
| lua-resty-libcjson | 基于LuaJIT FFI的nginx-module-lua的cJSON库 |
| lua-resty-libr3 | 基于libr3的高性能路径调度库,用于nginx-module-lua |
| lua-resty-limit-rate | 用于限制nginx-module-lua请求速率的Lua模块,使用"令牌桶"方法 |
| lua-resty-limit-traffic | 用于限制和控制nginx-module-lua中流量的Lua库 |
| lua-resty-lmdb | 使用 nginx-module-lua 操作 LMDB 数据库的安全 API |
| lua-resty-locations | 实现nginx风格位置URI匹配的Lua库 |
| lua-resty-lock | 基于共享内存字典的nginx-module-lua的简单非阻塞锁API |
| lua-resty-logger-socket | 基于原始套接字的 NGINX 日志库(基于 nginx-module-lua) |
| lua-resty-lrucache | 基于 LuaJIT FFI 的 Lua-land LRU 缓存 |
| lua-resty-macaroons | LuaJIT FFI 绑定到 libmacaroons – Macaroons 是灵活的授权凭证,支持去中心化的委托、减弱和验证 |
| lua-resty-mail | 一个高层次、易于使用且非阻塞的电子邮件和SMTP库,用于nginx-module-lua |
| lua-resty-maxminddb | 一个用于读取MaxMind地理位置数据库的Lua库 |
| lua-resty-memcached | 基于cosocket API的nginx-module-lua的Lua memcached客户端驱动程序 |
| lua-resty-mlcache | nginx-module-lua 的分层缓存库 |
| lua-resty-multiplexer | 流子系统的透明端口服务多路复用器 |
| lua-resty-murmurhash2 | LuaJIT MurmurHash 2 绑定到 NGINX / nginx-module-lua murmurhash2 实现 |
| lua-resty-mysql | 非阻塞 Lua MySQL 驱动库,用于 nginx-module-lua |
| lua-resty-nettle | Nettle 的 LuaJIT FFI 绑定(一个低级加密库) |
| lua-resty-nsq | 基于 cosocket API 的 nginx-module-lua 的 Lua nsq 客户端驱动程序 |
| lua-resty-ntlm | 由lua实现的Nginx ntlm模块 |
| lua-resty-openidc | 用于NGINX / nginx-module-lua的Lua中OpenID Connect依赖方和OAuth 2.0资源服务器实现 |
| lua-resty-openssl | 基于FFI的OpenSSL绑定用于nginx-module-lua |
| lua-resty-perf | 一个小型的 ngx resty lua 库,用于基准测试函数的内存和吞吐量 |
| lua-resty-prettycjson | Lua cJSON 美化格式器 |
| lua-resty-pubsub | 基于cosocket API的nginx-module-lua的Lua Pubsub客户端驱动程序 |
| lua-resty-qless | nginx-module-lua / Redis 的 Qless(队列/管道管理)Lua 绑定 |
| lua-resty-qless-web | Qless 的网页界面移植到 nginx-module-lua 环境 |
| lua-resty-rabbitmqstomp | 基于 cosocket API 的 nginx-module-lua 应用程序的有见地的 Lua RabbitMQ 客户端库 |
| lua-resty-rack | 一个简单且可扩展的 HTTP 服务器框架,用于 nginx-module-lua |
| lua-resty-radixtree | 在Lua / LuaJIT中实现的自适应基数树 |
| lua-resty-redis | 基于 cosocket API 的 nginx-module-lua 的 Lua redis 客户端驱动程序 |
| lua-resty-redis-connector | lua-resty-redis 的连接工具 |
| lua-resty-redis-ratelimit | 限制多个由 Redis 支持的 NGINX 实例之间的请求处理速率 |
| lua-resty-redis-util | Nginx-module-lua-resty-redis 封装工具类 |
| lua-resty-repl | nginx-module-lua 和 luajit 代码的交互式控制台 (REPL) |
| lua-resty-reqargs | 读取 application/x-www-form-urlencoded、multipart/form-data 和 application/json 请求参数 |
| lua-resty-requests | 另一个用于nginx-module-lua的HTTP库 - 为人类服务! |
| lua-resty-riak | 基于 cosocket API 的 nginx-module-lua 的 Lua riak 协议缓冲区客户端驱动程序 |
| lua-resty-router | 用于 nginx-module-lua 的 Lua http 路由器 |
| lua-resty-rsa | 用于nginx-module-luaJIT的RSA加密/解密和签名/验证 |
| lua-resty-scrypt | 基于LuaJIT FFI的scrypt库,用于nginx-module-lua |
| lua-resty-session | nginx-module-lua 的会话库 - 灵活且安全 |
| lua-resty-shell | 用于非阻塞系统 shell 命令执行的 Lua 模块 |
| lua-resty-signal | 用于终止或发送信号到 UNIX 进程的 Lua 库 |
| lua-resty-smtp | 使用NGINX发送邮件 |
| lua-resty-snappy | Snappy 的 LuaJIT FFI 绑定,一个快速的压缩/解压缩工具 (https://code.google.com/p/snappy/) |
| lua-resty-sniproxy | 基于stream-lua-nginx-module的SNI代理 |
| lua-resty-socket | 自动 LuaSocket/cosockets 兼容模块 |
| lua-resty-stats | 这是一个基于nginx-module-lua的nginx统计模块,统计键和值是可配置的,可以使用nginx核心的变量和该模块的变量。统计结果存储在mongodb中。 |
| lua-resty-string | nginx-module-lua 和 LuaJIT 的字符串工具和常见哈希函数 |
| lua-resty-t1k | Chaitin/SafeLine WAF 的 T1K 协议的 Lua 实现 |
| lua-resty-tags | 用于构建 HTML 文档的小型 DSL |
| lua-resty-tarantool | 用于从nginx与嵌入式Lua模块或nginx-module-lua一起使用的tarantool的库 |
| lua-resty-template | Lua和nginx-module-lua的模板引擎(HTML) |
| lua-resty-test | 基于nginx-module-lua的nginx-module-lua的Lua测试框架 |
| lua-resty-timer | nginx-module-lua的扩展定时器 |
| lua-resty-tlc | 通用二级缓存 (lrucache + shared dict) |
| lua-resty-tsort | 对输入数据执行拓扑排序 |
| lua-resty-txid | 为 nginx-module-lua/nginx 生成可排序的唯一事务或请求 ID |
| lua-resty-upload | 基于 nginx-module-lua cosocket 的 http 文件上传的流式读取器和解析器 |
| lua-resty-upstream | nginx-module-lua 的上游连接负载均衡和故障转移模块 |
| lua-resty-upstream-healthcheck | 纯 Lua 的 NGINX 上游服务器健康检查器 |
| lua-resty-uuid | LuaJIT FFI 绑定 libuuid,一个 DCE 兼容的通用唯一标识符库 |
| lua-resty-validation | Lua 和 nginx-module-lua 的验证库(输入验证和过滤) |
| lua-resty-vhost | nginx-module-lua 的主机名匹配库 |
| lua-resty-waf | 基于nginx-module-lua堆栈构建的高性能WAF |
| lua-resty-weauth | 适用于 nginx-module-lua 的基于企业微信组织架构的登录认证 |
| lua-resty-websocket | nginx-module-lua 模块的 WebSocket 支持 |
| lua-resty-websocket-proxy | WebSocket帧的反向代理 |
| lua-resty-woothee | Woothee Lua-nginx-module-lua 实现 |
| lua-resty-worker-events | NGINX中的纯Lua跨工作者事件 |
| lua-resty-xxhash | LuaJIT FFI绑定到xxHash,一个极快的非加密哈希算法 |