Rails App Images fail to render with Apache2 Server

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 D. with
Rails book. If anyone has come across this ‘problem’ before, please
help.

Regards
Leng

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

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

The images are now displaying with WEBrick and Apache servers.

Cheers,
Leng

On Nov 23, 8:47 pm, Frederick C.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs