Nginx Unit: open-source, lightweight and versatile application runtime

Role and Positioning of Nginx Unit

  • Described as an application server/runtime rather than a traditional reverse proxy.
  • Runs ASGI/WSGI apps, PHP directly (no php-fpm), and WebAssembly; also serves static assets.
  • Manages app workers per node and allows dynamic reconfiguration via an HTTP control API without downtime.
  • Often placed behind a reverse proxy/load balancer (nginx, Caddy, Traefik, or cloud LB) rather than exposed directly.

Feature Gaps and Limitations

  • Currently lacks some reverse-proxy features: detailed request/response rewriting, caching, compression, HTTP/2, and automatic TLS/Let’s Encrypt.
  • No built-in ACME is seen as a major missing piece; external tooling or wrappers (e.g., Jucenit, Ansible playbooks) are used instead.
  • Certificate rotation and hot-swapping are not as smooth as some would like.

Configuration and Developer Experience

  • Configuration is only via the control API; no canonical config files by design.
  • Official Docker images auto-import JSON configs from a directory, but custom images require scripts (wait-for-socket loops + curl), which some find clunky.
  • A new unitctl CLI is in development to simplify “wait and import” flows.
  • Several users find the JSON config and HTTP-based management clearer and more readable than nginx, Apache, or even Caddy configs, but error messages are terse and logging defaults (e.g., access logs) are not ideal.

Performance and Use Cases

  • Multiple reports of Unit being noticeably faster than stacks like nginx + gunicorn, or language-specific servers; external benchmarks are referenced.
  • Used successfully in production for high-traffic Python/Django and PHP (including WordPress), with some “cold start”-like behavior suspected but not fully diagnosed.
  • Seen as helpful for single-container setups where one process handles routing, static assets, and multiple language runtimes.

Comparison with Caddy and nginx

  • Compared to Caddy: Unit provides a true integrated runtime (PHP SAPI, ASGI/WSGI, WASM); Caddy typically relies on FastCGI or compiled-in plugins (e.g., FrankenPHP).
  • Compared to nginx: Unit simplifies app hosting but lacks nginx’s maturity, breadth of modules, and proxy features; nginx remains preferred where performance, L4/L7 flexibility, and traditional configs are valued.

Licensing and Perception

  • Unit is Apache 2.0 licensed; this is contrasted with concerns about other vendors that have relicensed or restricted their projects.
  • The “Nginx Unit” name causes search confusion with nginx proper and with expectations like “nginx unit testing.”