Forum: Ruby on Rails Images and stylesheets are not serving

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E13ea23a8a7e852bc7bf1952dff3d7b8?d=identicon&s=25 Matt Davies (vanderkerkoff)
on 2007-02-15 11:50
Hello

One of ours sites has just lost all it's images and styling.

It's not a very busy site at all, so it might have been not working
properly for some time now.

Here's how we start it in Lighty
<pre>
$HTTP["host"] == "gregynog.glam.ac.uk" {
  server.document-root = "/www/rails/greg/current/public/"
  server.error-handler-404 = "/dispatch.fcgi"
  accesslog.filename = "/www/rails/greg/current/log/access.log"
  server.errorlog = "/www/rails/greg/current/log/error.log"
  fastcgi.server = (".fcgi" =>
    ("greg" =>
        ( "socket" => "/www/rails/greg/shared/tmp/greg-0.socket" ),
        ( "socket" => "/www/rails/greg/shared/tmp/greg-1.socket" )))
}
</pre>

Here's an example of one of the erros from the production log


<pre>
ActionController::RoutingError (Recognition failed for
"/img/gregynog.jpg"):
    /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/routing.rb:488:in
`recognition_failed'
    /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/routing.rb:478:in
`recognize!'
    /usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:in
`dispatch'
    /usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:150:in
`process_request'
    /usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:54:in
`process!'
    /usr/lib/site_ruby/1.8/fcgi.rb:600:in `each_cgi'
    /usr/lib/site_ruby/1.8/fcgi.rb:117:in `session'
    /usr/lib/site_ruby/1.8/fcgi.rb:104:in `each_request'
    /usr/lib/site_ruby/1.8/fcgi.rb:36:in `each'
    /usr/lib/site_ruby/1.8/fcgi.rb:597:in `each_cgi'
    /usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:53:in
`process!'
    /usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:23:in
`process!'
    /www/rails/greg/current/public/dispatch.fcgi:24
</pre>

And finally here's the routes.rb form the application
<pre>
ActionController::Routing::Routes.draw do |map|
  map.accessibility
'/accessibility',:controller=>'pages',:action=>'accessibility'
  map.locationmap
'/location',:controller=>'pages',:action=>'locationmap'
  map.signup '/signup',:controller=>'people',:action=>'new'
  map.welsh
'/cymraeg',:controller=>'pages',:action=>'view',:language=>'cy',:title=>'welshindex'
  map.page
'/page/:title',:controller=>'pages',:action=>'view',:language=>'en'
  map.tudalen
'/tudalen/:title',:controller=>'pages',:action=>'view',:language=>'cy'
        map.connect
'',:controller=>'pages',:action=>'view',:language=>'en',:title=>'index'
  map.connect ':controller/:action/:id'
end
</pre>

We're not serving the img folder with a controller, but were using the
lighttpd to serve the static content, I think.

Anyone got any ideas what's happening?
70225136eacd3d870f64e03bff678655?d=identicon&s=25 Russell Norris (Guest)
on 2007-02-15 16:26
(Received via mailing list)
I dunno how lighty works exactly but as far as webrick, apache, mongrel,
etc... "/img/whatever.jpg" needs to be in the "img" subdirectory of the
"public" directory. Is that not the case here?

RSL
This topic is locked and can not be replied to.