ROR rails正常启动,但是http://127.0.0.1:3000不能访问的解决办法
程序员文章站
2022-06-07 08:41:02
...
D:\aaa>rails s
=> Booting WEBrick
=> Rails 3.2.16 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2014-10-14 16:14:26] INFO WEBrick 1.3.1
[2014-10-14 16:14:26] INFO ruby 1.9.3 (2013-11-22) [i386-mingw32]
[2014-10-14 16:14:26] INFO WEBrick::HTTPServer#start: pid=12800 port=3000
服务启动起来了,但是http://127.0.0.1:3000/不能访问。后台log里的消息是:
ArgumentError (A secret is required to generate an integrity hash for cookie session data. Use config.secret_token = "some secret phrase of at least 30 characters"in config/initializers/secret_token.rb):
解决办法:
rake generate_secret_token
或者
rake secret
原因是需要加密的字符串。