ScriptsMay 15, 2026·3 min read

Nginx Unit — Dynamic Polyglot Application Server

A lightweight application server by the Nginx team that runs Go, Python, Node.js, Java, Perl, PHP, Ruby, and WebAssembly apps behind a RESTful JSON API for zero-downtime configuration.

Agent ready

This asset can be read and installed directly by agents

TokRepo exposes a universal CLI command, install contract, metadata JSON, adapter-aware plan, and raw content links so agents can judge fit, risk, and next actions.

Needs Confirmation · 64/100Policy: confirm
Agent surface
Any MCP/CLI agent
Kind
Skill
Install
Single
Trust
Trust: Established
Entrypoint
Nginx Unit Overview
Universal CLI install command
npx tokrepo install 408c00ee-5037-11f1-9bc6-00163e2b0d79

Introduction

Nginx Unit is an application server built by the Nginx core team that can run applications in multiple languages simultaneously. Configuration is managed through a RESTful JSON API, allowing you to add routes, change listeners, and deploy new app versions without restarts or dropped connections.

What Nginx Unit Does

  • Serves applications written in Python, PHP, Go, Node.js, Java, Ruby, Perl, and WebAssembly
  • Provides a RESTful JSON API for runtime configuration without server restarts
  • Routes requests by URI, host, method, headers, and other properties
  • Handles TLS termination with automatic certificate management
  • Serves static files alongside dynamic applications in a single server

Architecture Overview

Unit uses a multi-process architecture with a controller process that owns the config API and router processes that handle incoming connections. Each application language runs in isolated worker processes managed by language-specific modules. Configuration changes are applied atomically: the controller validates the new config, forks new workers, drains old ones, and swaps routing tables with zero downtime.

Self-Hosting & Configuration

  • Install from the official repository for your OS or run the Docker image docker run -d unit
  • Send JSON configuration to the control socket at /var/run/control.unit.sock
  • Define listeners, routes, and applications in a single JSON document
  • Update any subtree of the config with PUT, PATCH, or DELETE requests
  • TLS certificates are uploaded as PEM bundles via the /certificates API endpoint

Key Features

  • Zero-downtime configuration: changes apply without connection drops
  • Per-application process isolation with configurable worker counts
  • Built-in request routing with pattern matching and header-based rules
  • Static file serving with MIME type detection and directory listings
  • Native WebAssembly support via the Wasm component model

Comparison with Similar Tools

  • Nginx — reverse proxy and static server; Unit adds native multi-language app serving with a config API
  • Apache — venerable multi-module server; Unit offers simpler dynamic configuration and polyglot support
  • Gunicorn — Python-only WSGI server; Unit handles multiple languages in one process tree
  • Caddy — automatic HTTPS reverse proxy; Unit focuses on application serving rather than proxying

FAQ

Q: Can Unit replace Nginx as a reverse proxy? A: Unit can proxy and serve apps, but Nginx remains stronger for complex proxy scenarios like load balancing pools and caching. They are often used together.

Q: How do I deploy a new app version without downtime? A: PUT the updated application config to the API. Unit spins up new workers, waits for in-flight requests to finish on old workers, then shuts them down.

Q: Does Unit support HTTP/2? A: Yes. HTTP/2 is supported on TLS listeners. HTTP/3 (QUIC) support is in development.

Q: What operating systems are supported? A: Unit runs on Linux, FreeBSD, and macOS. Official packages are available for major Linux distributions. Docker images are also provided.

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets