Facilitating the spread of knowledge and innovation in professional software development



Choose your language

InfoQ Homepage News NGINX Releases Open Source Web Server with Dynamic Configuration

NGINX Releases Open Source Web Server with Dynamic Configuration


NGINX recently released version 1.0 of Unit, an open-source web and application server. The server supports remote and dynamic configuration and incurs no service interruptions for configuration changes. Unit 1.0 also supports multiple languages (Go, Perl, PHP, Python, and Ruby) running on the same instance, including multiple versions of the same language.

NGINX Unit does not rely on a static configuration file, but is instead configured via a REST API using JSON. All configuration is stored directly in memory, allowing for changes to happen without restarting the running services. The router process is persistent and does not require a restart.

The basic configuration requires at least one listener and one application. The listener details on which port and IP address Unit will listen to and redirect to a named application. An application definition allows for specification of the language, the directories for the application's files, and the number of processes.

For example, you can define a listener on port 8300 to serve a PHP application located in /www/blogs/scripts using up to 20 processes:

    "listeners": {
        "*:8300": {
            "application": "blogs"

    "applications": {
        "blogs": {
            "type": "php",
            "processes": 20,
            "root": "/www/blogs/scripts",
            "index": "index.php"

The recommendation from Unit's documentation is to store this in a (version controlled) file and then post it to the server. If the data above is stored in a file called start.json, an initial configuration can be created as follows:

# curl -X PUT -d @/path/to/start.json --unix-socket /path/to/control.unit.sock http://localhost/

Unit keeps the router process separate from the application processes, which run the application code. Each application process pool is run in its own sandbox to ensure isolation from other processes. This isolation permits multiple applications running in different languages to share the same server.

NGINX Unit architecture (credit: NGINX)

NGINX Unit architecture (credit: NGINX)


In the following example, a Go and a Perl application are setup to run on the same Unit server:

    "listeners": {
       "*:8500": {
            "application": "go_chat_app"

        "": {
            "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 Owen Garrett, head of products at NGINX, Unit is suitable for stand-alone or microservices-based architectures. It supports on-demand scaling of processes, executing each process in its own sandbox.

NGINX plans to add language support for Java and Node.js in an upcoming release. The company has plans to support SSL and HTTP/2 as well as support for serving static content and routing using URIs and hostnames.

NGINX Unit is open source (Apache License 2.0) and there are pre-built packages available for most operating systems, including Debian, CentOS, Ubuntu, and others. There is also a Docker container available on Docker Hub.

We need your feedback

How might we improve InfoQ for you

Thank you for being an InfoQ reader.

Each year, we seek feedback from our readers to help us improve InfoQ. Would you mind spending 2 minutes to share your feedback in our short survey? Your feedback will directly help us continually evolve how we support you.

Take the Survey

Rate this Article


Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p


Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.