【发布时间】:2022-01-27 12:42:26
【问题描述】:
我将我的 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/*;
}
【问题讨论】:
-
nginx.config中有什么?寻找phusionpassenger.com/library/config/nginx/reference/… 并设置正确的ruby 路径。 -
@razvans 感谢您的回复。我不是真正的开发人员,但如果你也指的是
/etc/nginx/nginx.config,那它是空的。下面的看起来还可以吗?还是我需要其余的配置文件? ``` http { 乘客根 ...; # 默认使用 Ruby 2.1。乘客红宝石/usr/bin/ruby2.6.5; } ``` -
@razvans 我更新了我的问题以包含 nginx.config。我再次部署并重新启动了 nginx 和乘客,以防万一,但日志中仍然出现相同的错误。还有其他想法吗?
-
启用站点的文件中是否对passenger_ruby 有任何引用?
-
2 件事。 1 有可能在@razvans 提到的站点特定配置中有参考; 2. 我不确定你所说的“升级”红宝石是什么意思,但是这个系统似乎安装了 rvm(或者至少配置错误表明它确实如此),在这种情况下,你应该通过 rvm 安装红宝石,例如
rvm install 2.6.5然后引用rvm安装。