在aws上部署我的rails应用程序时,我收到以下错误。我无法弄清楚问题。我正在使用nginx和乘客。搜索了互联网但仍未找到任何解决方案。以下是错误日志文件的内容。
App 10537 stdout:
App 10537 stderr: --> Compiling passenger_native_support.so for the current Ruby interpreter...
App 10537 stderr:
App 10537 stderr: (set PASSENGER_COMPILE_NATIVE_SUPPORT_BINARY=0 to disable)
App 10537 stderr:
App 10537 stderr: --> Downloading precompiled passenger_native_support.so for the current Ruby interpreter...
App 10537 stderr:
App 10537 stderr: (set PASSENGER_DOWNLOAD_NATIVE_SUPPORT_BINARY=0 to disable)
App 10537 stderr:
App 10537 stderr: Could not download https://oss-binaries.phusionpassenger.com/binaries/passenger/by_release/5.0.13/rubyext-ruby-2.2.0-x8$
App 10537 stderr: Trying next mirror...
App 10537 stderr: Could not download https://s3.amazonaws.com/phusion-passenger/binaries/passenger/by_release/5.0.13/rubyext-ruby-2.2.0-x$
App 10537 stderr: --> Continuing without passenger_native_support.so.
App 10537 stderr: Rails Error: Unable to access log file. Please ensure that /usr/share/nginx/html/trans-info/log/production.log exists and is$
App 10560 stdout:
App 10537 stderr: [ 2015-07-10 22:00:38.0639 10560/0x00000000e1da20(Worker 1) utils.rb:85 ]: *** Exception RuntimeError in Rack application ob$
App 10537 stderr: from /home/ubuntu/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/application.rb:520:in `validate_secret_key_config$
App 10537 stderr: from /home/ubuntu/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/application.rb:246:in `env_config'
App 10537 stderr: from /home/ubuntu/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/engine.rb:514:in `call'
App 10537 stderr: from /home/ubuntu/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/application.rb:164:in `call'
App 10537 stderr: from /usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb:94:in `process_request'
App 10537 stderr: from /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:149:in `accept_and_process_next_req$
App 10537 stderr: from /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:110:in `main_loop'
App 10537 stderr: from /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:415:in `block (3 levels) in start_threads'
App 10537 stderr: from /usr/lib/ruby/vendor_ruby/phusion_passenger/utils.rb:111:in `block in create_thread_and_abort_on_exception'
[ 2015-07-10 22:00:38.0641 10511/7fdb5a226700 age/Cor/Req/Utils.cpp:95 ]: [Client 1-1] Sending 502 response: application did not send a comple$
App 10567 stdout:
App 10574 stdout:
问题是关于我猜的秘密密钥。我尝试执行以下操作来设置生产环境的密钥。但它仍然无法解决问题。
export SECRET_KEY_BASE=<rake secret>
ruby -e 'p ENV["SECRET_KEY_BASE"]'
答案 0 :(得分:1)
我通过使用生成的rake secret
密钥更新yourapp / config / secrets.yml中的文件来修复Rails 4.2.3中的这个问题
您将在该文件中看到开发和测试环境行具有随机生成的密钥,如:
development:
secret_key_base: 0d61219baac693241c55f0d5e32casdasdasdasdas3adc915d60f303bb55bfe0f9c7d3d7c77914ebba3924529b0f55fa2ddc2f861052d9b7bb25ea5d1asdasdasdasdas8d857ed2dc8df0cdccd3a
test:
secret_key_base: 12df598106f9f303d34c087aasdasdas85f7439b86e881788340c85e932aa14579661c0606b29ac9ff6438619e65b8ac0abd201e7asdasdasdsad2555d77d975a8c522032e8bfa956bb3
# Do not keep production secrets in the repository,
# instead read values from the environment.
production:
secret_key_base: 5b2555128d5b97181d2a65aeasdasdasddd2cb4d7df37b49dd97de7ebb2305d56a1c649be86bff3fc48536543eead7091018e5casdasdasdasdasd5c563c6ca02771e1b5f99cbc35db886cd9
和制作有类似的东西:
生产: secret_key_base:&lt;%= ENV [“SECRET_KEY_BASE”]%&gt;
所以我用rake secret
命令生成的密钥
production:
secret_key_base: 5b2555128d5b97181d2a65aeasdasdasddd2cb4d7df37b49dd97de7ebb2305d56a1c649be86bff3fc48536543eead7091018e5casdasdasdasdasd5c563c6ca02771e1b5f99cbc35db886cd9