问题描述
我想将Rails应用程序部署到数字海洋飞船上,并且一切似乎都配置正确,但是出现此错误:
I'm tyring to deploy a rails app to a digital ocean droplet and all seems to be configured ok but I get this error:
An unhandled lowlevel error occurred. The application logs may have details.
由于日志为空,我不确定该怎么办.
I'm not sure what to do as the logs are empty.
这是nginx的配置:
Here's the nginx config:
upstream puma {
server unix:///home/yourcv.rocks/shared/tmp/sockets/yourcv.rocks-puma.sock;
}
server {
listen 80 default_server deferred;
server_name 127.0.0.1;
root /home/yourcv.rocks/current/public;
access_log /home/yourcv.rocks/current/log/nginx.access.log;
error_log /home/yourcv.rocks/current/log/nginx.error.log info;
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
try_files $uri/index.html $uri @puma;
location @puma {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://puma;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 10M;
keepalive_timeout 10;
}
谢谢! :)
推荐答案
这是因为您没有正确设置密钥.仔细检查您的config/secrets.yml文件:应该是这样的:
This is because you haven't set your secret key correctly. Double check your config/secrets.yml file: It should be something like this:
production: secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
production: secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
然后在小滴中,运行bundle exec rake secret
即可获取密钥.像dotenv
这样的选项是有用的gem,可以将.env文件的内容加载到ENV中.
Then in your droplet, you can run bundle exec rake secret
to get your secret key. There are options like dotenv
which is a useful gem that loads the contents of a .env file into ENV.
这篇关于发生未处理的低级错误.应用程序日志可能包含详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!