NGINX Unit 0.6 Beta Release Now Available

Today we are releasing the sixth beta version (0.6) of NGINX Unit, our new dynamic web and application server. In this blog post, we discuss the latest changes in detail.

Important: There are changes to the configuration API. Be sure to read Advanced Process Management in its entirety before upgrading your existing NGINX Unit installation.

NGINX Unit is under active development. It’s likely that at the time you read this blog post, even more recent releases will be available. Check https://unit.nginx.org/CHANGES.txt for details on the latest release.

With the addition of Perl support, we can now run applications like Bugzilla, a popular bug‑tracking system written in Perl.

Advanced Process Management

In previous versions of NGINX Unit, the only way to limit the worker count was to include the workers parameter of the application object. Theworkersparameter has been removed and now you can manage your application more granularly with the new processes{} object, as described in the following sections.

Setting the Maximum Number of Workers with the max Parameter

When application load rises, NGINX Unit creates more application processes. However, it does not fork more application processes than the maximum defined by the max parameter of the processes{} object. The default is 1.

When the application starts, Unit will create the number of workers specified in the spare parameter of the processes {} object. When the load is low, and the processes are idle, Unit will scale down to the number specified by the parameter. By default, this parameter is set to 0.

Prefork and Scaling Down Unused Workers with the spare Parameter

When an application starts, NGINX Unit creates the number of workers specified by the spare parameter of the processes{} object. When the load is low, and processes are idle, NGINX Unit scales down to the number specified by the parameter. The default is 0.

The number of spare processes must be less than or equal to the maximum number of processes. Thus, you cannot set spare to more than 1 unless you also set the max parameter to a value higher than its default of 1.

This example creates five application processes at startup, scales up to ten processes when the load increases, and scales back down to as few as five processes when the load is low:

Basic Process Management

If you want to use a simpler, static process model, you can set the processes option to an integer value. In that case, NGINX Unit starts the specified number of application processes immediately, and keeps them active without scaling up or down.

An example for an application object:

{
"type": "php",
"root": "/srv/myblog",
"processes": 10
}

Support for Perl/PSGI

NGINX Unit now supports the Perl Server Gateway Interface (PSGI).

Notes:

PSGI applications are different from Perl CGI applications, which NGINX Unit does not support.

We have tested NGINX Unit with various versions of Perl, the earliest being 5.12. It may work with older versions as well, but you need to verify that.

The unit-perl binary package is available in our repository for all supported operating systems. See the complete installation instructions in the NGINX Unit documentation.

If you compile NGINX Unit from source, you need to install developer libraries for Perl before compiling the source:

As with the other languages that Unit supports, you can use all listener, process management, and security features the same way with Perl applications as you do with any other app.

Official Docker Containers

Docker containers for NGINX Unit are now available on Docker Hub. The Tags tab lists the containers available for various combinations of NGINX Unit version (represented in the list by unit) and application version:

unit-full (for example, 0.6-full) includes the modules for all supported languages and also runs precompiled Go apps. If you are unsure which languages you will want to use, use this container.

unit-minimal does not include modules and interpreters for any languages, but can run precompiled Go apps.

unit-pythonPython_version can run Python scripts and precompiled Go apps.

unit-go1.7-dev and unit-go1.8-dev can compile Go apps with the appropriate NGINX and NGINX Unit packages for the specified version of Go, as well as run precompiled Go apps.

The :latest tag (used by default) links to the -full container for the newest version of NGINX Unit (at the time of writing, 0.6-full).

In the simplest case, to run Unit in Docker pull and run nginx/unit, then use the API from within the container to configure NGINX Unit.

If you need to do more sophisticated configuration, you can mount the volumes and have the container socket accessible from the host or from another container, or have the control socket available via a TCP port.

Support for Amazon Linux

Conclusion

With the 0.6 version, NGINX Unit is getting close to the functionality, language support, and reliability it will have when we reach general availability (GA) with Unit 1.0, which is described in our road map blog post and shown in the demo on YouTube. Please continue to experiment with NGINX Unit and submit your feedback on GitHub.

Have a Cookie? :)

Our site uses cookies to provide functionality and performance as well as for social media and advertising purposes. Social media and advertising cookies of third parties are used to offer you social media functionalities and personalized ads for NGINX content and offers. To get more information about these cookies and how we process personal data, check our Privacy Policy. Do you accept the use of cookies and the processing of personal data involved?

Your Cookie Settings

Site functionality and performance

These cookies are required for NGINX site functionality and are therefore always enabled. These include cookies that allow you to be remembered as you explore the NGINX site, help make the shopping cart and checkout process possible as well as assist in security issues and conforming to regulations. To use the NGINX website, you have to consent to these cookies and the processing of personal data according to the NGINX website terms of use and privacy policy.

Social media and advertising

Social media cookies offer the possibility to connect you to your social networks and share content from our website through social media. Advertising cookies (of third parties) collect information to help better tailor NGINX advertising to your interests, both within and beyond NGINX websites. De-selecting these cookies may result in seeing advertising that is not as relevant to you or you not being able to link effectively with Facebook, Twitter, or other social networks and/or not allowing you to share content on social media.