Nginx Unit 1.27.0 发布

介绍

Nginx Unit 是一个动态应用服务器,能够与 Nginx Plus 和 Nginx 开源版并行或独立运行。Nginx Unit 支持 RESTful JSON API,可以在不中断服务的情况下更改配置,并可运行基于多种语言和架构的应用。Nginx Unit 生来就是为满足分布式应用的需求而设计的,可为您的服务网格奠定坚实的基础。

更新内容

Nginx Unit 1.27.0 正式发布,更新内容如下:

将 HTTP 请求重定向到 HTTPS

自从在 Unit 中加入了 TLS 支持和证书管理,就被要求简化将纯文本 HTTP 请求重定向到启用 TLS 的监听器。现在可以通过配置路由 action 的 location 值来实现这一功能。事实上,现在有一个新的变量, $request_uri,它包含了原始 URI 的路径和查询部分,完整的例子如下:

{     "listeners": {         "*:443": {             "tls": {                 "certificate": "example.com"             },             "pass": "routes"         },         "*:80": {             "pass": "routes"         }      },      "routes": [         {             "match": {                 "scheme": "http"             },             "action": {                 "return": 301,                 "location": "<https://$>{host}${request_uri}"             }         } } 复制代码

这种配置使 Unit 能够监听纯文本和启用 TLS 的端口,确保在纯文本端口收到的任何请求都会通知浏览器在启用 TLS 的端口重新提交。

为纯路径 URI 提供可配置的文件名

现在你可以通过为路由 action 指定索引来使用不同的默认文件名。下面提供了一个完整的例子:

"routes": [     {         "match": {             "uri": "/cms/*"         },         "action": {             "share": "/var/cms$uri",             "index": "default.html"         }     },     {         "action": {             "share": "/var/www$uri"         }     } ] 复制代码

这个配置使 Unit 能够为指向 /cms/* 的纯路径 URI 提供 default.html,为所有其他纯路径的 URI 提供默认的 index.html 文件名。

完整的更新日志

这个版本还包括许多错误修复。完整的更新日志可以在下面看到。

*) Feature: ability to specify a custom index file name when serving    static files.  *) Feature: variables support in the "location" option of the "return"    action.  *) Feature: support empty strings in the "location" option of the    "return" action.  *) Feature: added a new variable, $request_uri, that includes both the    path and the query parts as per RFC 3986, sections 3-4.  *) Feature: Ruby Rack environment parameter "SCRIPT_NAME" support.  *) Feature: compatibility with GCC 12.  *) Bugfix: Ruby Sinatra applications don't work without custom logging.  *) Bugfix: the controller process could crash when a chain of more than    four certificates was uploaded.  *) Bugfix: some Perl applications failed to process the request body,    notably with Plack.  *) Bugfix: some Spring Boot applications failed to start, notably with    Grails.  *) Bugfix: incorrect Python protocol auto detection (ASGI or WSGI) for    native callable object, notably with Falcon.  *) Bugfix: ECMAScript modules did not work with the recent Node.js    versions. 复制代码

其他

  • 与 GCC 12 兼容
  • 错误修正:一些 Spring Boot 应用程序无法启动
  • 错误修正:Python 协议的自动检测不正确
  • 错误修正:ECMAScript 模块不能与最近的 Node.js 版本一起使用

平台更新

官方软件包现在可用于以下 Linux 发行版:

  • Fedora 36
  • RHEL 9
  • Ubuntu 22.04

Docker 镜像已经更新,以使用最新的语言版本:

  • Go 1.18
  • PHP 8.1
  • Ruby 3.1

更多资讯请查看该链接:unit.nginx.org/news/2022/u…

发表评论

相关文章