问题描述
我的情况很像 SemiFixed: Missing `secret_key_base` for生产"环境:
我的配置/secrets.yml
my config/secrets.yml
production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
我在/etc/environment 中添加了一个条目,以便在我登录并键入时
I have added an entry in /etc/environment so that when I log in and type
echo $SECRET_KEY_BASE
我得到了用 rake secret 创建的长字符串.但是我仍然收到 500 错误,因为 Missing secret_key_base for 'production' environment,在 config/secrets.yml 中设置这个值,即使我重置了整个计算机.那么还有什么可能出错?
I get the long string I created with rake secret. But still I get 500 error for Missing secret_key_base for 'production' environment, set this value in config/secrets.yml, even after I reset the entire computer. So what else can go wrong?
推荐答案
发现/etc/environment 被 apache2 忽略.将以下内容添加到/etc/apache2/envvars 解决了我的问题:
Found out that /etc/environment is ignored by apache2. Add the following to /etc/apache2/envvars solved my problem:
export SECRET_KEY_BASE=<the long string>
这篇关于生产环境缺少密钥库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!