ruby-on-rails – 502 Bad Gateway / rails 4 / nginx / passenger 4.0.49 /

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – 502 Bad Gateway / rails 4 / nginx / passenger 4.0.49 /前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我找不到我的错误……以及如何解决它.

它似乎有2个错误

我也觉得我的服务器没有启动,我不知道在哪里查找但是
tmp中的文件restart.txt无法清除,(即使在chmod 777 tmp之后)
所以我认为我的服务器在更改后没有重新启动.

我试图在公用文件夹中创建一个index.html文件.
它的工作原理. index.html看起来很好

cat /var/log/Nginx/error.log

App 10349 stderr: [ 2014-08-23 13:25:55.4598 10419/0x00000001c8b3c8(Worker 1) utils.rb:72 ]: *** Exception RuntimeError in Rack application object (Missing `secret_key_base` for 'production' environment,set this value in `config/secrets.yml`) (process 10419,thread 0x00000001c8b3c8(Worker 1)):
App 10349 stderr:       from /home/server/.rvm/gems/ruby-2.1.2/gems/railties-4.1.5/lib/rails/application.rb:452:in `validate_secret_key_config!'
App 10349 stderr:       from /home/server/.rvm/gems/ruby-2.1.2/gems/railties-4.1.5/lib/rails/application.rb:195:in `env_config'
App 10349 stderr:       from /home/server/.rvm/gems/ruby-2.1.2/gems/railties-4.1.5/lib/rails/engine.rb:510:in `call'
App 10349 stderr:       from /home/server/.rvm/gems/ruby-2.1.2/gems/railties-4.1.5/lib/rails/application.rb:144:in `call'
App 10349 stderr:       from /home/server/.rvm/gems/ruby-2.1.2/gems/passenger-4.0.49/lib/phusion_passenger/rack/thread_handler_extension.rb:74:in `process_request'
App 10349 stderr:       from /home/server/.rvm/gems/ruby-2.1.2/gems/passenger-4.0.49/lib/phusion_passenger/request_handler/thread_handler.rb:141:in `accept_and_process_next_request'
App 10349 stderr:       from /home/server/.rvm/gems/ruby-2.1.2/gems/passenger-4.0.49/lib/phusion_passenger/request_handler/thread_handler.rb:109:in `main_loop'
App 10349 stderr:       from /home/server/.rvm/gems/ruby-2.1.2/gems/passenger-4.0.49/lib/phusion_passenger/request_handler.rb:448:in `block (3 levels) in start_threads'
2014/08/23 13:25:55 [error] 10328#0: *12 upstream prematurely closed connection while reading response header from upstream,client: 83.205.180.121,server:,request: "GET / HTTP/1.1",upstream: "passenger:/tmp/passenger.1.0.10303/generation-0/request:",host: "195.154.114.102"
server@sd-22885:~/blog/config$

cat secrets.yml

# Do not keep production secrets in the repository,# instead read values from the environment.
production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>

我的env =>

SECRET_KEY_BASE=39d95ff31bba12f1ea6bf0f2e332fc7b4797679b04ce9d45deb155fdc090a57960ee3fae82383fa18015c9444f5828769ae896c5dbe32e0916da23b79304f7fc

sudo vim / etc / Nginx / sites-enabled / default

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    # server_name mydomain.com;
    passenger_enabled on;
    rails_env    production;
    root         /home/server/blog/public;


    # client_max_body_size                            32M;
    # client_body_buffer_size                         512k;
    # proxy_connect_timeout                           90;
    # proxy_send_timeout                              90;
    # proxy_read_timeout                              1200;
    # proxy_buffers                                   32 4k;
}

谢谢

解决方法

你尝试过设置吗?
passenger_set_cgi_param SECRET_KEY_BASE "39d95ff31bba12f1ea6bf0f2e332fc7b4797679b04ce9d45deb155fdc090a57960ee3fae82383fa18015c9444f5828769ae896c5dbe32e0916da23b79304f7fc";

在您的网站配置?

猜你在找的Ruby相关文章