我找不到我的错误......以及如何修复它。
它似乎有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 =&gt;
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;
}
谢谢你
答案 0 :(得分:9)
您是否尝试过设置
passenger_set_cgi_param SECRET_KEY_BASE "39d95ff31bba12f1ea6bf0f2e332fc7b4797679b04ce9d45deb155fdc090a57960ee3fae82383fa18015c9444f5828769ae896c5dbe32e0916da23b79304f7fc";
在您的网站配置中?
答案 1 :(得分:0)
尝试正确缩进您的secrets.yml文件:
production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
错误说它无法为生产环境找到此变量。