Get started with OpenResty — install on Linux, macOS, or Docker, then write Lua inside Nginx using the ngx API for routing, caching, and Redis-backed services.
Tutorial series
Lua Openresty
5 tutorials — follow in order for the best learning path.
- Getting Started with OpenResty
- Routing and Middleware in OpenResty
Implement routing middleware in OpenResty with Lua scripts across Nginx request phases: rewrite, access, content, log.
- Building a REST API with OpenResty
Building REST APIs with OpenResty: routing, JSON handling, shared-dict caching, error recovery, external HTTP.
- Rate Limiting with Lua and Shared Dicts
Learn how to implement rate limiting in OpenResty using ngx.shared.DICT, covering fixed window counters, token buckets, and lua-resty-limit-traffic.
- Using Redis from Lua in OpenResty
Use Redis Lua client lua-resty-redis in OpenResty: connection pooling, pipelining, Pub/Sub, transactions, ngx.null.