简体   繁体   English

Rails,在使用unicorn和nginx的Ubuntu上缺少“生产”的“ secret_key_base”

[英]Rails, Missing `secret_key_base` for 'production' on Ubuntu with unicorn and nginx

I'm trying to run my rails app on Ubuntu for the first time using nginx and unicorn. 我正在尝试使用nginx和unicorn首次在Ubuntu上运行Rails应用程序。 My question is, when I look at my log, I see the following error. 我的问题是,当我查看日志时,看到以下错误。

`app error: Missing `secret_key_base` for 'production' environment, set this value in `config/secrets.yml` (
RuntimeError)`

I looked at my secrets.yml which looks like, 我看了看我的secrets.yml

...    
production:
      secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>

...

When I type echo $SECRET_KEY_BASE on my command line to check to make sure that the key is set, I get a secret key, which seems to indicate that the key is correctly set. 当我在命令行上键入echo $SECRET_KEY_BASE来检查以确保已设置密钥时,我得到了一个秘密密钥,这似乎表明密钥已正确设置。 What is missing here? 这里缺少什么?

Your unicorn process runs as root. 您的独角兽进程以root身份运行。 however you probably set your key with non-root user. 但是,您可能将密钥设置为非root用户。
To fix this problem, I recommend you to use dotenv( https://github.com/bkeepers/dotenv ). 要解决此问题,我建议您使用dotenv( https://github.com/bkeepers/dotenv )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Rails在生产中缺少SECRET_KEY_BASE - Rails missing SECRET_KEY_BASE in production 在rails生产中缺少secret_key_base - Missing secret_key_base in rails production rails 中缺少生产 secret_key_base - Missing production secret_key_base in rails Ubuntu 18.04 服务器(Rails 6.0)上的“生产”环境缺少“secret_key_base”,尝试了多个主题 - Missing `secret_key_base` for 'production' environment on Ubuntu 18.04 server (Rails 6.0), multiple topics tried ruby on rails:heroku:“生产”环境缺少“secret_key_base” - ruby on rails: heroku: Missing `secret_key_base` for 'production' environment Rails:如何修复“生产环境中缺少 secret_key_base” - Rails: How to fix “Missing secret_key_base for 'production' environment” SECRET_KEY_BASE 缺少生产错误 - SECRET_KEY_BASE missing error on production 缺少&#39;secret_token`和`secret_key_base`用于&#39;生产&#39;环境 - Missing `secret_token` and `secret_key_base` for 'production' environment 在&#39;生产&#39;环境中缺少`secret_key_base`,在Ubuntu Server上的config / secrets.yml中设置此值 - Missing `secret_key_base` for 'production' environment, set this value in config/secrets.yml on Ubuntu Server 如何解决错误“‘生产’环境缺少‘secret_key_base’”(Rails 4.1) - How to solve error “Missing `secret_key_base` for 'production' environment” (Rails 4.1)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM