乘客一直在寻找错误的 ruby 版本
Passenger keeps looking for wrong ruby version
我将 ruby 版本升级到 2.6.5。我使用 capistrano 将它部署到我的服务器。
但是我的 nginx 日志是这样说的:
App 9470 output: /bin/sh: 1: exec: /home/deploy/.rvm/gems/ruby-2.3.1/wrappers/ruby: not found
[ E 2022-01-27 12:34:23.7336 9450/Tc age/Cor/App/Implementation.cpp:221 ]: Could not spawn process for application /home/deploy/taddar/current: The application process exited prematurely.
Error ID: d1f83ca0
Error details saved to: /tmp/passenger-error-0KwZUf.html
[ E 2022-01-27 12:34:23.7393 9450/T9 age/Cor/Con/CheckoutSession.cpp:276 ]: [Client 1-1] Cannot checkout session because a spawning error occurred. The identifier of the error is d1f83ca0. Please see earlier logs for details about the error.
当我 运行 ruby -v
我得到 2.6.5,但在上面你可以看到它正在寻找 2.3.1:
ruby -v
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]
关于如何解决这个问题有什么想法吗?
在我的 deploy.rb 中,我设置了 ruby 版本。
set :rvm_ruby_version, '2.6.5'
我的 nginx.config 看起来像:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
passenger_ruby /usr/bin/ruby2.6.5;
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
underscores_in_headers on;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon;
##
# Phusion Passenger config
##
# Uncomment it if you installed passenger or passenger-enterprise
##
include /etc/nginx/passenger.conf;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
宾果成功了。感谢@razvans 和@engineersmnky 为我指明了正确的方向。
是的,我提到了 passenger_ruby
,但它放错了地方。我不得不去 /etc/nginx/sites-available
并添加 passenger_ruby /path/to/ruby
要找出 /path/to/ruby
是什么,请使用 passenger-config about ruby-command
并使用 Command
处的值。
passenger-config about ruby-command
passenger-config was invoked through the following Ruby interpreter:
Command: /home/deploy/.rvm/gems/ruby-2.6.5/wrappers/ruby
所以我的是
server {
....
passenger_ruby /home/deploy/.rvm/gems/ruby-2.6.5/wrappers/ruby
您可能想知道您必须 ruby 的任何其他参考资料,以免它们相互冲突。一个有用的命令是:grep -rnw 'path' -e 'passenger_ruby'
这个文档对我帮助很大https://www.phusionpassenger.com/library/deploy/nginx/deploy/ruby/#determine_ruby_command
我将 ruby 版本升级到 2.6.5。我使用 capistrano 将它部署到我的服务器。
但是我的 nginx 日志是这样说的:
App 9470 output: /bin/sh: 1: exec: /home/deploy/.rvm/gems/ruby-2.3.1/wrappers/ruby: not found
[ E 2022-01-27 12:34:23.7336 9450/Tc age/Cor/App/Implementation.cpp:221 ]: Could not spawn process for application /home/deploy/taddar/current: The application process exited prematurely.
Error ID: d1f83ca0
Error details saved to: /tmp/passenger-error-0KwZUf.html
[ E 2022-01-27 12:34:23.7393 9450/T9 age/Cor/Con/CheckoutSession.cpp:276 ]: [Client 1-1] Cannot checkout session because a spawning error occurred. The identifier of the error is d1f83ca0. Please see earlier logs for details about the error.
当我 运行 ruby -v
我得到 2.6.5,但在上面你可以看到它正在寻找 2.3.1:
ruby -v
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]
关于如何解决这个问题有什么想法吗?
在我的 deploy.rb 中,我设置了 ruby 版本。
set :rvm_ruby_version, '2.6.5'
我的 nginx.config 看起来像:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
passenger_ruby /usr/bin/ruby2.6.5;
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
underscores_in_headers on;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon;
##
# Phusion Passenger config
##
# Uncomment it if you installed passenger or passenger-enterprise
##
include /etc/nginx/passenger.conf;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
宾果成功了。感谢@razvans 和@engineersmnky 为我指明了正确的方向。
是的,我提到了 passenger_ruby
,但它放错了地方。我不得不去 /etc/nginx/sites-available
并添加 passenger_ruby /path/to/ruby
要找出 /path/to/ruby
是什么,请使用 passenger-config about ruby-command
并使用 Command
处的值。
passenger-config about ruby-command
passenger-config was invoked through the following Ruby interpreter:
Command: /home/deploy/.rvm/gems/ruby-2.6.5/wrappers/ruby
所以我的是
server {
....
passenger_ruby /home/deploy/.rvm/gems/ruby-2.6.5/wrappers/ruby
您可能想知道您必须 ruby 的任何其他参考资料,以免它们相互冲突。一个有用的命令是:grep -rnw 'path' -e 'passenger_ruby'
这个文档对我帮助很大https://www.phusionpassenger.com/library/deploy/nginx/deploy/ruby/#determine_ruby_command