PROVIDER - Edge platform on Nginx and Lua
OpenResty
OpenResty bundles an enhanced Nginx core with LuaJIT and curated modules into an open-source web platform where Lua scripts request handling, auth and origin logic, cited at 10,000 to over a million connections per box, often used as an edge node or gateway.
3.9pts
Service Overview
OpenResty packages an enhanced Nginx core, an enhanced LuaJIT, a set of Lua libraries and third-party Nginx modules into one web platform, maintained chiefly by Yichun Zhang (agentzh). It was sponsored by Yahoo China and Taobao in its early years, supported mainly by Cloudflare from 2012 to 2016, and now runs under the OpenResty Software Foundation and OpenResty Inc.
It is explicitly not an Nginx fork but an application and gateway platform built on Nginx as a component, with most kernel patches already submitted upstream. Typical uses include dynamic gateways, web application firewalls, access layers for mobile and advertising services, and edge nodes that need per-request auth and routing.
Key Strengths
- Extends Nginx from above as a component, scripting request and origin logic in Lua.
- The project cites 10,000 to over a million concurrent connections on a single box.
- Non-blocking I/O covers backends such as databases and caches, not just clients.
- Bundled components are mostly BSD-style licences, keeping commercial use approachable.
- Community mailing lists give free support, while enterprise plans come from the vendor.
Limitations
- It is an application and gateway platform, so cache and scheduling policy must be built.
- Scripting requests in Lua adds flexibility but makes debugging harder than plain config.
- The open-source edition carries no SLA or vendor support; enterprise plans are separate.
- Official documentation is English-first, with Chinese material largely community-driven.
- Only the runtime is provided, leaving consoles and canary release tooling to be built.
Product Ecosystem
The figure below layers the runtime, with Lua logic running above the Nginx core.
Runtime Components
The runtime combines the Nginx core, LuaJIT, Lua libraries and third-party modules, and the component list is published. Kernel patches have mostly gone upstream and accepted, and new features keep flowing in from the official Nginx and LuaJIT repositories.
Lua Ecosystem
Lua code runs in the rewrite, access, content and log phases, and cosockets reach MySQL, PostgreSQL, Memcached and Redis without blocking. Shared memory dictionaries let workers share cache entries and rate-limit counters, which is the usual base for gateway features.
Enterprise Plans and XRay
OpenResty Inc. sells enterprise plans and commercial support, and OpenResty XRay performs runtime dynamic tracing and profiling, locating hot spots in both Lua and C layers without restarting the service.
Deployment Shapes
It can be compiled from source or installed from distribution packages and container images; one binary runs on large bare-metal servers and on resource-constrained embedded devices. Production setups usually pair it with configuration management and a release system for canary and rollback.
Use Cases
- Good fit | Self-built gateways and access layers: Lua handles auth, rate limits and routing per request.
- Good fit | Multi-backend aggregation: cosockets talk to several data sources concurrently.
- Good fit | CDN edge nodes needing request logic: cache keys and canary rules change inside the node.
- Good fit | Teams with Nginx operations experience: existing config habits carry over.
- Evaluate first | Sites that only need static delivery: a standard CDN or plain Nginx covers it.
- Evaluate first | Teams without Lua skills: debugging and tuning get harder.
- Evaluate first | Production systems demanding a vendor SLA: enterprise plans must be signed.
Pricing & Billing Selection
| Access path | Reference price | Billing unit | Main capability |
|---|---|---|---|
| OpenResty (open source) | Free (USD 0) | Per deployment node, no licence fee | BSD-style licences, Nginx core, LuaJIT and modules |
| Community support | Free (USD 0) | Official mailing lists | Peer answers and shared experience |
| Enterprise plans | Commercial licence | Per contract | Commercial support and services from OpenResty Inc. |
| OpenResty XRay | Commercial subscription | Per node or subscription | Dynamic tracing, flame graphs and diagnostics |
Source note: details come from openresty.org and openresty.com in November 2026. The open-source edition is free with BSD-style component licences, while enterprise plans and XRay are contracted commercially with unpublished pricing.
FAQ
-
How does it differ from Nginx?
OpenResty is not an Nginx fork; it treats Nginx as a component and builds an application and gateway platform on top. Beyond the enhanced core it bundles LuaJIT, a set of Lua libraries and third-party modules, so request handling, authentication and origin logic are scripted in Lua instead of patched in C. -
Can it serve as a CDN edge node?
Yes, with some assembly required. OpenResty supplies request routing, cache control and high concurrency, and a common pattern is to implement auth, canary routing, cache-key rewriting and scheduling on the edge node itself; node orchestration, certificate distribution, monitoring and billing still need separate tooling. -
How much concurrency can one server handle?
The project cites 10,000 to over a million concurrent connections per box, depending on hardware, request mix and Lua quality. It uses the Nginx event model for non-blocking I/O, holding long-lived client connections while reaching MySQL, PostgreSQL, Memcached and Redis asynchronously. -
What about licensing and support?
Bundled components are mostly BSD-style licences, which keeps commercial use and modification approachable; the community answers questions on the official mailing lists, while commercial support and enterprise plans come from OpenResty Inc. Confirm the licence terms and support scope of individual modules before procurement. -
Which teams does it suit?
Teams with Nginx operations experience that need business logic moved into the gateway: web application firewalls, canary routing, dynamic authentication or multi-backend aggregation. For plain static delivery a CDN or Nginx already covers the need, and teams needing a vendor SLA should sign an enterprise plan.
Integration & Code Examples
Example 1: A minimal Lua response
worker_processes auto;
events { worker_connections 1024; }
http {
server {
listen 8080;
location /health {
content_by_lua_block {
ngx.say("ok")
}
}
}
}
Example 2: Test the config and reload
openresty -t
openresty -s reload
curl -s http://127.0.0.1:8080/health
Example 3: Rewrite the cache key per request
location /assets/ {
set_by_lua_block $cache_key {
return ngx.var.uri .. "_" .. (ngx.var.arg_v or "0")
}
proxy_cache_key $cache_key;
proxy_pass http://origin_backend;
}
Community & Resources
Official channels
- OpenResty — project home and downloads
- Component list — bundled software and versions
- Chinese site — Chinese documentation and tutorials
- OpenResty Inc. — enterprise plans and commercial support
- GitHub repository — source and issue tracker
Ecosystem and comparison
- CDN Acceleration — CDN and edge platform directory
- Nginx — the runtime core OpenResty builds on
- Varnish Cache — memory-first open-source HTTP accelerator
- Apache Traffic Server — open-source caching proxy
- Cloudflare — general CDN and edge platform
Articles
- 01 DCDN Acceleration and Cache Safety 07-18
- 02 Two-Factor Authentication: Implementation and Recovery 07-18
- 03 CDN Bill Decomposition and Cost Order 07-18
- 04 Video Streaming CDN: Protocol and Cache Design 07-18
- 05 Multi-CDN Routing and Failover Setup 07-18
- 06 Zero Trust Architecture: Decisions, Not a Gateway 07-18
- 07 Vulnerability Scanner Selection 07-18
- 08 Let's Encrypt Certificate Setup and Renewal 07-18
- 09 CDN Onboarding: DNS and Origin Checks 07-18
- 10 SSL Certificate Types: DV, OV, EV Differences and Validation Scope 07-18