How NGINX Unit 1.0 Enables Dynamic Multi‑Language Backend Services
NGINX Unit 1.0 is an open‑source web and application server that lets you run multiple programming languages such as Go, Perl, PHP, Python, and Ruby via a JSON‑based REST API, offering dynamic, in‑memory configuration, sandboxed process isolation, and seamless micro‑service integration.
NGINX recently released NGINX Unit 1.0. NGINX Unit is an open‑source web and application server designed to run multiple programming languages and be dynamically configured through an API.
Version 1.0 supports running Go, Perl, PHP, Python, Ruby and multiple versions of the same language within a single instance.
According to Zhihu user Huang Xin, Unit effectively replaces gunicorn/FastCGI/uWSGI for Python (and similar for other languages), providing a unified Web Server entry point while applications focus solely on business logic.
NGINX Unit does not rely on static configuration files; instead it uses JSON via a REST API. All configurations are stored in memory, allowing changes without restarting services, and routing updates are applied continuously.
Basic configuration requires at least one listener and one application. Listeners define the IP and port Unit listens on and map to a named application. Applications specify language, directory, and process count.
Example: a listener on port 8300 serving a PHP application located in /www/blogs/scripts with up to 20 processes.
{
"listeners": {
"*:8300": {
"application": "blogs"
}
},
"applications": {
"blogs": {
"type": "php",
"processes": 20,
"root": "/www/blogs/scripts",
"index": "index.php"
}
}
}The recommended practice is to store such JSON in a version‑controlled file and POST it to the Unit control socket, e.g.:
# curl -X PUT -d @/path/to/start.json --unix-socket /path/to/control.unit.sock http://localhost/Unit separates routing processes from application processes. Each application pool runs in its own sandbox, ensuring isolation and allowing multiple applications in different languages to share the same server.
Another example shows running Go and Perl applications on the same Unit server.
{
"listeners": {
"*:8500": {"application": "go_chat_app"},
"127.0.0.1:8600": {"application": "bugtracker"}
},
"applications": {
"go_chat_app": {
"type": "go",
"user": "www-chat",
"group": "www-chat",
"working_directory": "/www/chat",
"executable": "bin/chat_app"
},
"bugtracker": {
"type": "perl",
"processes": 3,
"user": "www",
"group": "www",
"working_directory": "/www/bugtracker",
"script": "app.psgi"
}
}
}According to NGINX product lead Owen Garrett, Unit works for both monolithic and micro‑service architectures, supporting on‑demand process scaling and sandboxed execution.
Future releases plan to add Java and Node.js support, as well as SSL, HTTP/2, and URI/hostname‑based static content and routing.
NGINX Unit is released under the Apache License 2.0, with pre‑built packages for major operating systems (Debian, CentOS, Ubuntu) and an official Docker image.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
21CTO
21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
