参考 https://github.com/ruby-china/ruby-china/wiki/Ubuntu-14.04-%E4%B8%8A%E4%BD%BF%E7%94%A8-Nginx-Passenger-%E9%83%A8%E7%BD%B2-Ruby-on-Rails 在阿里云上部署了一个应用,结果总是报 这个错误
We're sorry, but something went wrong.
We've been notified about this issue and we'll take a look at it shortly.
nginx 的配置成开发环境正常
server {
listen 80 default;
server_name huwai78.com;
root /home/david/huwai78/public;
passenger_enabled on;
#rails_env production;
rails_env development;
}
能够正常访问,然后 baidu google 了半天没有找到合适的解决办法 就采用这种方式启动
rails s -e production
报错信息如下
=> Booting Puma
=> Rails 4.2.1 application starting in production on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
/home/david/huwai78/app/models/user.rb:1:in `<top (required)>': superclass mismatch for class User (TypeError)
from /home/david/.rvm/gems/ruby-2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
from /home/david/.rvm/gems/ruby-2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `block in require'
from /home/david/.rvm/gems/ruby-2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
from /home/david/.rvm/gems/ruby-2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
from /home/david/.rvm/gems/ruby-2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:360:in `require_or_load'
from /home/david/.rvm/gems/ruby-2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:317:in `depend_on'
from /home/david/.rvm/gems/ruby-2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:233:in `require_dependency'
from /home/david/.rvm/gems/ruby-2.2.0/gems/railties-4.2.1/lib/rails/engine.rb:472:in `block (2 levels) in eager_load!'
from /home/david/.rvm/gems/ruby-2.2.0/gems/railties-4.2.1/lib/rails/engine.rb:471:in `each'
from /home/david/.rvm/gems/ruby-2.2.0/gems/railties-4.2.1/lib/rails/engine.rb:471:in `block in eager_load!'
from /home/david/.rvm/gems/ruby-2.2.0/gems/railties-4.2.1/lib/rails/engine.rb:469:in `each'
from /home/david/.rvm/gems/ruby-2.2.0/gems/railties-4.2.1/lib/rails/engine.rb:469:in `eager_load!'
from /home/david/.rvm/gems/ruby-2.2.0/gems/railties-4.2.1/lib/rails/engine.rb:346:in `eager_load!'
from /home/david/.rvm/gems/ruby-2.2.0/gems/railties-4.2.1/lib/rails/application/finisher.rb:56:in `each'
from /home/david/.rvm/gems/ruby-2.2.0/gems/railties-4.2.1/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>'
from /home/david/.rvm/gems/ruby-2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `instance_exec'
from /home/david/.rvm/gems/ruby-2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `run'
from /home/david/.rvm/gems/ruby-2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/david/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
from /home/david/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /home/david/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
from /home/david/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /home/david/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:345:in `each'
from /home/david/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:345:in `call'
from /home/david/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
from /home/david/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
from /home/david/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
from /home/david/.rvm/gems/ruby-2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:54:in `run_initializers'
from /home/david/.rvm/gems/ruby-2.2.0/gems/railties-4.2.1/lib/rails/application.rb:352:in `initialize!'
from /home/david/huwai78/config/environment.rb:5:in `<top (required)>'
from /home/david/.rvm/gems/ruby-2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
from /home/david/.rvm/gems/ruby-2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `block in require'
from /home/david/.rvm/gems/ruby-2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
from /home/david/.rvm/gems/ruby-2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
from /home/david/huwai78/config.ru:3:in `block in <main>'
from /home/david/.rvm/gems/ruby-2.2.0/gems/rack-1.6.0/lib/rack/builder.rb:55:in `instance_eval'
from /home/david/.rvm/gems/ruby-2.2.0/gems/rack-1.6.0/lib/rack/builder.rb:55:in `initialize'
from /home/david/huwai78/config.ru:in `new'
from /home/david/huwai78/config.ru:in `<main>'
from /home/david/.rvm/gems/ruby-2.2.0/gems/rack-1.6.0/lib/rack/builder.rb:49:in `eval'
from /home/david/.rvm/gems/ruby-2.2.0/gems/rack-1.6.0/lib/rack/builder.rb:49:in `new_from_string'
from /home/david/.rvm/gems/ruby-2.2.0/gems/rack-1.6.0/lib/rack/builder.rb:40:in `parse_file'
from /home/david/.rvm/gems/ruby-2.2.0/gems/rack-1.6.0/lib/rack/server.rb:299:in `build_app_and_options_from_config'
from /home/david/.rvm/gems/ruby-2.2.0/gems/rack-1.6.0/lib/rack/server.rb:208:in `app'
from /home/david/.rvm/gems/ruby-2.2.0/gems/railties-4.2.1/lib/rails/commands/server.rb:61:in `app'
from /home/david/.rvm/gems/ruby-2.2.0/gems/rack-1.6.0/lib/rack/server.rb:336:in `wrapped_app'
from /home/david/.rvm/gems/ruby-2.2.0/gems/rack-1.6.0/lib/rack/server.rb:272:in `start'
from /home/david/.rvm/gems/ruby-2.2.0/gems/railties-4.2.1/lib/rails/commands/server.rb:80:in `start'
from /home/david/.rvm/gems/ruby-2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:80:in `block in server'
from /home/david/.rvm/gems/ruby-2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /home/david/.rvm/gems/ruby-2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `server'
from /home/david/.rvm/gems/ruby-2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /home/david/.rvm/gems/ruby-2.2.0/gems/railties-4.2.1/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'