I am install redmine on CentOS 7.2,Rails 4.2, ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux-gnu].when I am started server using command:
ruby /usr/local/bin/rails server webrick -e production –d
And login:http://localhost:3000. throws:
Missing `secret_token` and `secret_key_base` for 'production' environment, set these values in `config/secrets.yml`
development:
secret_key_base: 58176e0eea05......
test:
secret_key_base: 58176e0eea05......
# Do not keep production secrets in the repository,
# instead read values from the environment.
production:
secret_key_base: 58176e0eea05......
I have already tried to generate a key,What should I do to make it right?
This is the detail log:
[root@localhost redmine]# ruby /usr/local/bin/rails server webrick -e production –d
=> Booting WEBrick
=> Rails 4.2.7.1 application starting in production on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2016-11-17 04:09:06] INFO WEBrick 1.3.1
[2016-11-17 04:09:06] INFO ruby 2.0.0 (2014-11-13) [x86_64-linux]
[2016-11-17 04:09:06] INFO WEBrick::HTTPServer#start: pid=2972 port=3000
http://localhost:3000[2016-11-17 04:09:25] ERROR RuntimeError: Missing `secret_token` and `secret_key_base` for 'production' environment, set these values in `config/secrets.yml`
/usr/local/share/gems/gems/railties-4.2.7.1/lib/rails/application.rb:534:in `validate_secret_key_config!'
/usr/local/share/gems/gems/railties-4.2.7.1/lib/rails/application.rb:246:in `env_config'
/usr/local/share/gems/gems/railties-4.2.7.1/lib/rails/engine.rb:514:in `call'
/usr/local/share/gems/gems/railties-4.2.7.1/lib/rails/application.rb:165:in `call'
/usr/local/share/gems/gems/rack-1.6.5/lib/rack/lock.rb:17:in `call'
/usr/local/share/gems/gems/rack-1.6.5/lib/rack/content_length.rb:15:in `call'
/usr/local/share/gems/gems/rack-1.6.5/lib/rack/handler/webrick.rb:88:in `service'
/usr/share/ruby/webrick/httpserver.rb:138:in `service'
/usr/share/ruby/webrick/httpserver.rb:94:in `run'
/usr/share/ruby/webrick/server.rb:295:in `block in start_thread'
Generate a secret key:
#change to redmine directory
cd /var/www/redmine
#generate secret key
rake secret RAILS_ENV=production
export SECRET_KEY_BASE=generate key
#check secret key
echo $SECRET_KEY_BASE
reboot.