我的问题是类似这样的Rails 3.2 Asset Pipeline with Passenger Endless Errors不同之处在于当我试图真正去的Rails 3.2资产管道薄壁和Apache,没有找到资产
<link href="/assets/application-eed7996ee9017637f923133371ab3e92.css" media="all" rel="stylesheet" type="text/css" />
,我收到了404.这是我不要的东西”不明白。它正在寻找/ assets /,但是当我查看已部署的代码时,资产只在/ public/assets中,这实际上是/ var/www/myapp/shared/assets的符号链接。那么世界上有什么人负责告诉应用程序,查看/资产会产生正确的结果?
我正在使用Rails 3.2.0,ruby-1.9.3-p125,部署到Ubuntu,Apache和Thin。
我应该澄清:我的资产确实部署到服务器。一切都很好,直到他们需要服务,在这种情况下,production.log告诉我它正在/assets/application-eed7996ee9017637f923133371ab3e92.css中寻找它们,这是404的。
为每个请求我thin.log说
cache: [GET /] miss
和production.log说
ActionController::RoutingError (No route matches [GET] "/assets/application-abecf2e096af9ee80697fd49e79a55e7.js"):
UPDATE 的帮助@Brandan感谢。我的资产确实在RAILS_ROOT/public/assets
。我把这个在我的Apache的虚拟主机文件:
DocumentRoot /var/rails/myappname/current/public
RewriteEngine On
XSendFile On
XSendFilePath /var/rails/myappname #not even sure if this line is needed
<LocationMatch "^/assets/.*$">
Header unset ETag
FileETag None
ExpiresActive On
ExpiresDefault "access plus 1 year"
</LocationMatch>
我RAILS_ROOT /配置/环境/ production.rb设置:
config.cache_classes = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.serve_static_assets = false
config.assets.compress = true
config.assets.compile = false
config.assets.digest = true
config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
您如何创建您的链接? – apneadiving 2012-02-24 20:31:18
在我的布局中我说'<%= stylesheet_link_tag“application”,:media =>“all”%>'和'<%= javascript_include_tag“应用程序”%>' – DelPiero 2012-02-24 21:18:16
您是否预编译了您的资产? – ka8725 2012-02-24 22:30:11