Published by the nginx unit website, the latest release of Nginx Unit (1.31.0) brings new features to the platform that allows for the launching of web applications in various programming languages. This includes Python, PHP, Perl, Ruby, Go, JavaScript/Node.js, and Webassembly Java. With Nginx Unit, multiple applications in different programming languages can be simultaneously executed, and the launch of these applications can be dynamically changed without the need for manual configuration editing or file restarts. The code is written in si language and is available under the Apache 2.0 license. More information about the features of Nginx Unit can be found in the initial announcement.
In the latest version of Nginx Unit (1.31.0), several significant updates have been introduced:
- An experimental module has been added to support the execution of applications using WEBASSEMBLY – a universal intermediate code that can be launched on any operating system. When using Just-in-Time (JIT) compilation, WEBASSEMBLY demonstrates performance comparable to native code execution.
- The Action and Fallback blocks now support the “Response_headers” expression, enabling the addition, deletion, or modification of HTTP headers. This is done by providing a list in the format of “name_head/value” as a parameter. If the specified header name matches an existing header in the response, the header value will be changed. If the header is not present, it will be added. To remove a header, the value can be set to “Null”. The values can be generated using JavaScript functions (NJS) or fixed data.
- New variables have been added that contain the values of HTTP status codes in the responses. These variables can be used to modify existing headers or create new ones. For example, this can be achieved by using the following configuration: {“Action”: {“Pass”: “Applications/Calc”, “Response_headers”: {“Content-type”: “$ {Response_header_content_type}; Charso-8859-1”}}}
- The UNITC command-line utility now allows for editing the Nginx Unit JSON configuration through API calls. By using the “Unitc Edit /Config” command, users can modify the configuration without manually editing the JSON file.
- For applications written in Python using the ASGI (Asynchronous Server Gateway Interface) protocol, support for the “Lifespan_state” parameter has been added.