1.14 以上的 Nginx 版本是否已弃用 Passenger?

Is Passenger Deprecated for Nginx versions above 1.14?

我在 Ubuntu 18.04 上将 nginx 从版本 1.14 更新到 1.18 (Ubuntu)

这样做似乎会破坏乘客。所以我卸载并尝试通过 Passenger installation Ubuntu 18.04 instructions.

重新安装 Open Source Passenger 版本

我到了这一行:

sudo apt-get install -y libnginx-mod-http-passenger

抛出这个错误

libnginx-mod-http-passenger : Depends: nginx-common (< 1.14.1) but 1.18.0-3ubuntu1+bionic1 is to be installed

更新 我也尝试过企业版。按照企业版安装说明,收到类似的错误信息:

libnginx-mod-http-passenger-enterprise : Depends: nginx-common (< 1.14.1) but 1.18.0-3ubuntu1+bionic1 is to be installed

我确实尝试研究了这个问题,但我发现了 this issue on Phusion's GitHub as well as this more recent issue。似乎大多数人正在做的是将他们的 nginx 版本回滚到 1.14.

它没有被弃用,没有。问题是您尝试安装的打包模块是为通过系统默认存储库分发的旧 Nginx 版本制作的。这出现在您提到的 installation guide 中:

At this point we assume that you already have Nginx installed from your system repository.

这意味着以下说明假定您安装了 Nginx 特定版本(在您的情况下为 1.14.0),并为此构建了打包模块。 new passenger documentation:

中强调了这一点

If you want to use our packaged Nginx module, you must use your distro's provided Nginx package. If for example you have the repo provided by NGINX setup, you will instead need to compile a dynamic module compatible with that Nginx.

最后引用中的 link 将带您了解如何编译动态乘客模块并在 Nginx 配置中启用它的指南。我不会重复整个过程以使答案简短,但一般方法是这样的:

  1. 获取 Nginx 源代码的 passenger 模块。
  2. 获取您所安装版本的 Nginx 源代码。
  3. 用 passenger 模块编译 Nginx:
cd /path-to-nginx-source-dir
./configure --prefix=/opt/nginx \
  --with-some-configure-flag \
  --add-dynamic-module=$(passenger-config --nginx-addon-dir) \
  --add-module=/path-to-some-other-nginx-module
make
sudo make install
  1. 通过将此行添加到 nginx.conf 让 Nginx 加载模块:
load_module modules/ngx_http_passenger_module.so;

就个人而言,我宁愿选择 'nginx-behind-nginx' 方法也不愿构建模块。那就是你有任何你喜欢的 Nginx 版本,但它作为另一个 Nginx 的反向代理运行,启用了 passenger (Passenger Standalone)。由于对性能的影响不明显,这将更容易维护(安装、更新)。有关详细信息,请参阅此 guide