服务器在rails 3生产环境中找不到公用文件夹
我正在使用最新的 Rails 3 beta。该应用程序在开发模式下运行良好,但是当我通过rails server -e production 在生产模式下启动服务器时,似乎找不到public 文件夹。我收到如下错误消息:
ActionController::RoutingError (No route matches "/javascripts/jquery.js"):
对于应该位于 public
文件夹中的所有内容,我都会收到类似的消息。 我已经用 mongrel 和 webrick 尝试过了。我将不胜感激任何帮助。
I'm using the latest rails 3 beta. The app works fine in development mode, but when I start the server in production mode via rails server -e production
, it seems that the public
folder can't be found. I get error messages like:
ActionController::RoutingError (No route matches "/javascripts/jquery.js"):
And similar messages for everything that should be in the public
folder.
I've tried this with both mongrel and webrick. I'd appreciate any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
编辑 config/environments/production.rb 并设置此行:
config.serve_static_assets = true
editing config/environments/production.rb and setting this line:
config.serve_static_assets = true
nginx、unicorn 和 apache 会自动执行此操作。如果您使用这些服务器进行部署,请务必将其更改回 false。
nginx, unicorn and apache will do this automatically. be sure to change this back to false if you are deploying using these servers.