使用 RVM 为不同 Ruby 版本编译 Passenger Native Support

Compile Passenger Native Support with RVM for different Ruby versions

在 CentOS 7 上进行全新安装。

作为新用户 Passenger 在 ~/.rvm 中安装了 RVM

托管的所有网站都归 Apache 用户所有

安装了带有 2 个红宝石的 RVM:

我在默认 Ruby 1.9.3 中将 Passenger 安装并编译为 gem。

但是,我在使用 Ruby 2.3.0:

的网站上的 /var/log/httpd/error_log 中不断收到这些条目
App 12909 stdout:
App 12909 stderr:  [passenger_native_support.so] trying to compile for the current user (apache) and Ruby interpreter...
App 12909 stderr:      (set PASSENGER_COMPILE_NATIVE_SUPPORT_BINARY=0 to disable)
App 12909 stderr:      Warning: compilation didn't succeed. To learn why, read this file:
App 12909 stderr:      /tmp/passenger_native_support-bqcp0n.log
App 12909 stderr:  [passenger_native_support.so] finding downloads for the current Ruby interpreter...
App 12909 stderr:
App 12909 stderr:      (set PASSENGER_DOWNLOAD_NATIVE_SUPPORT_BINARY=0 to disable)
App 12909 stderr:      Could not download https://oss-binaries.phusionpassenger.com/binaries/passenger/by_release/5.0.26/rubyext-ruby-2.3.0-x86_64-linux.tar.gz: The requested URL returned error: 404 Not Found
App 12909 stderr:      Trying next mirror...
App 12909 stderr:      Could not download https://s3.amazonaws.com/phusion-passenger/binaries/passenger/by_release/5.0.26/rubyext-ruby-2.3.0-x86_64-linux.tar.gz: The requested URL returned error: 403 Forbidden
App 12909 stderr:  [passenger_native_support.so] will not be used (can't compile or download)
App 12909 stderr:   --> Passenger will still operate normally.

现在,通常你会简单地 运行 passenger-config build-native-support 但这显然只适用于内置乘客 gem 的 Ruby 环境(= 1.9.3 ).

如何构建对所有 RVM 安装版本的本机支持并消除此错误?

简单 运行 'passenger-config build-native-support' 使用 Ruby 您希望为其编译。

例如:

rvm use 2.3.0
ruby /path-to-passenger-config build-native-support

Passenger 不关心您使用哪个 Ruby 安装 Passenger。您可以将 Passenger 与任何 Ruby 一起使用,无论您使用哪个 Ruby 安装 Passenger。 https://www.phusionpassenger.com/library/indepth/ruby/multiple_rubies.html