这是我第一次设置乘客和nginx
我主要阅读本指南
https://gorails.com/deploy/ubuntu/14.04
deploy@localhost:/var/log/nginx$ tail error.log
config.ru:1:in `new'
config.ru:1:in `<main>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:112:in `eval'
/usr/share/passenger/helper-scripts/rack-preloader.rb:112:in `preload_app'
/usr/share/passenger/helper-scripts/rack-preloader.rb:158:in `<module:App>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:28:in `<main>'
[ 2015-01-15 21:29:59.5563 22279/7f4ceffff700 agents/HelperAgent/RequestHandler.h:2306 ]: [Client 20] Cannot checkout session because a spawning error occurred. The identifier of the error is f4e9d607. Please see earlier logs for details about the error.
我已将以下内容添加到生成的nginx.conf文件
中passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /home/deploy/.rbenv/shims/ruby;
我正在使用rbenv
我的/ etc / nginx / sites-enabled / default
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
# Make site accessible from http://localhost/
server_name localhost;
passenger_enabled on;
#passenger_load_shell_envvars off
rails_env production;
root /home/deploy/appname/current/public;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
passenger_enabled on;
}
}
我尝试在bashrc中完成/退出之前移动rbenv路径。我还试图不加载bashrc。
我的deploy.rb看起来很好
# config valid only for current version of Capistrano
lock '3.3.5'
set :application, 'appname'
set :repo_url, 'git@bitbucket.org:myself/appname.git'
#Basic Settings
set :deploy_to, "/home/deploy/appname"
set :user, 'deploy'
#set :use_sudo, false
set :port, 22
set :rails_env, :production
#set :use_sudo, true
#symbolic files and directories
set :linked_files, %w{config/database.yml config/secrets.yml}
set :linked_dirs, %w{tmp/pids tmp/cache tmp/sockets log bin vendor/bundle public/system}
set :log_level, :info
#setting rbenv settings
# set :rbenv_ruby, '2.1.2'
# set :rbenv_type, :user
# set :rbenv_prefix, "RBENV_ROOT=#{fetch(:rbenv_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)} #{fetch(:rbenv_path)}/bin/rbenv exec"
# set :rbenv_path, '/home/deploy/.rbenv'
# set :rbenv_map_bins, %w{rake gem bundle ruby rails}
# set :rbenv_roles, :all
#just pointing to our unicorn.rb
#set :unicorn_config_path, "config/unicorn.rb"
#capistrano tasks and processes
after "deploy", "deploy:cleanup"
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
execute :touch, release_path.join('tmp/restart.txt')
end
end
after :publishing, 'deploy:restart'
after :finishing, "deploy:cleanup"
end
我正在使用上限3.我评论了rbenv,因为我认为乘客可以通过乘客红宝石插入找到它。