0

我使用 Capistrano 将我的 rails 项目导入到 nginx 服务器中。我的项目在我的开发机器上完美运行,但在生产服务器中,浏览器显示“错误 500”。我试过 $nano log/production.log来查看错误,我明白了,但我删除了这个文件,现在,服务器说同样的错误,但我在production.log中没有看到,现在没有了显示任何错误。

我的部署.rb

require "bundler/capistrano"
require 'new_relic/recipes'

load "config/recipes/base"
load "config/recipes/nginx"
load "config/recipes/nodejs"
load "config/recipes/unicorn"
load "config/recipes/postgresql"
load "config/recipes/rbenv"
load "config/recipes/monit"
load "config/recipes/check"
load "config/recipes/newrelic"

server "rails.supera.com.br", :web, :app, :db, primary: true
# server "vagrant.dev",         :web, :app, :db                 # Maquina virtual
# server '54.232.212.216',      :web, :app, :db, primary: true  # Amazon server

set :user, "deployer"
set :application, "webapp"
set :deploy_to, "/home/#{user}/rails_apps/#{application}"
set :deploy_via, :remote_cache
set :use_sudo, false

set :scm, "git"
set :repository, "git@bitbucket.org:nicoskaralis/wt_#{application}.git"
set :branch, "dev"

default_run_options[:pty] = true
ssh_options[:forward_agent] = true

after "deploy", "deploy:cleanup" # keep only the last 5 releases

# Opções avançadas rbenv
set :default_environment, {
  'PATH' => "$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH"
}
set :bundle_flags, "--deployment --quiet --binstubs --shebang ruby-local-exec"

# Debug rake
# set :rake, "#{rake} --trace"

# Criar usuario novo
# sudo adduser deployer --ingroup admin
# cat ~/.ssh/id_rsa.pub | ssh deployer@rails.supera.com.br 'mkdir -p ~/.ssh/ && cat >> ~/.ssh/authorized_keys'
# echo "deployer ALL=(ALL:ALL) ALL" >> /etc/sudoers

# Deploy inicial em uma maquina zero
# cap deploy:install
# cap deploy:setup
# cap deploy:cold

# Deploy de uma nova versão na maquina ja instalada
# cap deploy
4

1 回答 1

0

如果您遇到错误 500,则可能是正在为其提供服务的 Web 服务器(nginx 或 apache),因为应用程序服务器(如乘客)在能够显示页面或创建日志之前崩溃。检查来自您的 Web 服务器的日志(/var/log/apache2/对于 apache)。

这可能是错误的,但每次我在 Rails 应用程序上看到错误 500 时,都是因为编码(UTF-8/ASCII)问题。

于 2013-06-21T22:33:33.547 回答