luaguides

Tutorial series

Lua Openresty

5 tutorials — follow in order for the best learning path.

  1. Getting Started with OpenResty

    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.

  2. Routing and Middleware in OpenResty

    Implement routing middleware in OpenResty with Lua scripts across Nginx request phases: rewrite, access, content, log.

  3. Building a REST API with OpenResty

    Building REST APIs with OpenResty: routing, JSON handling, shared-dict caching, error recovery, external HTTP.

  4. 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.

  5. Using Redis from Lua in OpenResty

    Use Redis Lua client lua-resty-redis in OpenResty: connection pooling, pipelining, Pub/Sub, transactions, ngx.null.