Hi Rails app works fine using WEBrick, (localhost:3000) but when using Apache2 (localhost:80), all images on page fail to render. Apache2 error_log reports: [error] [client 127.0.0.1] File does not exist: /srv/www/htdocs/images/rubyonrails.jpg... ... Rails log/development.log does not report any error. DocumentRoot "/srv/www/htdocs" I am working through the DEPOT app in the Agile Web Development with Rails book. If anyone has come across this ''problem'' before, please help. Regards Leng --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2006-Nov-23 09:47 UTC
Re: Rails App Images fail to render with Apache2 Server
Where is your rails app ? IIRC you need to set DocumentRoot to the path to your rails app + public, eg DocumentRoot "/srv/www/my_rails_app/public" Fred -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
The Apache config is correct as all the depot pages are working except for the images -- they are not displaying using Apache. Thanks to a ''Note About Links and Static Content'' on the wiki "HowtoUseSymLinksToGraftRailsOntoYourWebsite", after reading it I switched to using using Rails'' ''image_tag'' , instead of HTML ''<img src... '' as follows: <%= image_tag product.image_url, :alt => "", :size => "60x70" %> instead of <img width="60" height="70" src="<%= product.image_url %>" /> The images are now displaying with WEBrick and Apache servers. Cheers, Leng On Nov 23, 8:47 pm, Frederick Cheung <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Where is your rails app ? IIRC you need to set DocumentRoot to the path > to your rails app + public, eg > DocumentRoot "/srv/www/my_rails_app/public" > > Fred > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---