2
votes

I have a Rails 3.1.0 application on a live server which when started in development mode serves all images and favicon.ico nicely.

But when the same app is started in production environment, the favicon image/other images in public folder are not served and their paths throws a 404 error (Interestingly, the static images of the 404 page are also not served). Any clue Rails Gods?

I am using NginX + Unicorn + Rails 3.1.0. Assets pipeline is used for everything except for 404/500 error pages and favicon.

3

3 Answers

4
votes

I needed to show the files in my public folder in production mode too. I set "config.serve_static_assets" to true in "config/environments/production.rb", and it worked.

0
votes

Have you tried moving all your images to app/assets/images instead? That is where the asset pipeline in Rails 3.1 serves images from. (For example, in a fresh 3.1.0 app, the rails.png file is now in app/assets/images instead of 'public/images').

0
votes

FYI; if you're pulling up CSS background images, then you need to put in 'assets/imagename.jpg' instead of the old route of even just 'imagename.jpg'