【发布时间】:2016-07-17 13:52:28
【问题描述】:
我有一个带有 nginx 和 unicorn 的 Ubuntu 14.04 服务器。我已将带有 capistrano 的 Rails 应用程序部署到 /home/rails/myapp。
当尝试使用 sudo service unicorn restart 重新启动独角兽时,我得到以下信息:
* Restarting Unicorn web server unicorn
rack not available, functionality reduced
rack and Rack::Builder must be available for processing config.ru
尝试在浏览器中访问该站点时,我从 nginx 收到 502。
这是我的 /etc/default/unicorn 文件:
# Change paramentres below to appropriate values and set CONFIGURED to yes.
CONFIGURED=yes
# Default timeout until child process is killed during server upgrade,
# it has *no* relation to option "timeout" in server's config.rb.
TIMEOUT=60
# Path to your web application, sh'ld be also set in server's config.rb,
# option "working_directory". Rack's config.ru is located here.
APP_ROOT=/home/rails/myapp/current
# Server's config.rb, it's not a rack's config.ru
CONFIG_RB=/etc/unicorn.conf
# Where to store PID, sh'ld be also set in server's config.rb, option "pid".
PID=/home/rails/myapp/current/pids/unicorn.pid
RAILS_ENV="production"
UNICORN_OPTS="-D -c $CONFIG_RB -E $RAILS_ENV"
PATH=/usr/local/rvm/rubies/ruby-2.3.0/bin:/usr/local/sbin:/usr/bin:/bin:/sbin:/usr/local/rvm/bin:/usr/local/rvm/gems/ruby-2.3.0@global/bin:/usr/local/rvm/gems/ruby-2.3.0/bin/
export GEM_HOME=/usr/local/rvm/gems/ruby-2.3.0
export GEM_PATH=/usr/local/rvm/gems/ruby-2.3.0:/usr/local/rvm/gems/ruby-2.3.0@global
DAEMON=/usr/local/rvm/gems/ruby-2.3.0/wrappers/unicorn
这是我的 /etc/unicorn.conf 文件:
listen "unix:/var/run/unicorn.sock"
worker_processes 4
user "rails"
working_directory "/home/rails/myapp/current"
pid "/var/run/unicorn.pid"
stderr_path "/var/log/unicorn/unicorn.log"
stdout_path "/var/log/unicorn/unicorn.log"
有什么想法吗?我觉得我什么都试过了。
【问题讨论】:
标签: ruby-on-rails ubuntu capistrano unicorn digital-ocean