ruby-on-rails - 502 Bad Gateway/rails 4/nginx/乘客 4.0.49/

标签 ruby-on-rails nginx passenger

我找不到我的错误......以及如何解决它。

它似乎有2个错误

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

我试图在公用文件夹中创建一个 index.html 文件。
它工作。 index.html 看起来不错

猫/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$

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

我的环境 =>
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-on-rails - 502 Bad Gateway/rails 4/nginx/乘客 4.0.49/,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25461854/

相关文章:

ruby-on-rails - Sucker Punch Job 被 Passenger 杀死?还是死锁?

ruby-on-rails - rails 5,nginx + passenger,无法提供静态 Assets (404)

ruby-on-rails - Phusion错误:Sass::Util:Module的未定义方法 `has?'

ruby-on-rails - Rails - 按小时排序

ssl - 哪个先出现 - 创建 nginx 站点 `.conf` 文件或运行 `certbot-auto certonly` ?

nginx/413 请求实体太大

amazon-web-services - 如何使用 nginx ingress 将流量从 route53 中的域转发到 pod?

ruby-on-rails - 如何制作我的 Ruby on Rails 2.3.4 应用程序 "Rails 3-ready"

ruby-on-rails - 多种请求格式的单一 View 模板

ruby-on-rails - 未定义的方法 `build' 为 nil :NilClass rails