1
votes

all.

I have a Rails app, and when it under development environment, images will display in the page, but if I turn into production mode, all the images will response 404 not found.

Rails version: 3.0.7 Web Server: thin

1
in config/environments/production.rb change config.serve_static_assets = false to be true. But remember to turn it to off on actual production machine. Thin, unicorn etc. are not fr serving static files. You should use apache or nginx in front of your app server to load balance multiple instances of app server and serve static files.rubish
Thanks Rubish. I didn't try the way you told me in this morning, but it works! I didn't change anything in production.rb ... Thanks for your help again :)徐赫謙
It happened again, and I tried rubish's answer and it works! Thank you again.徐赫謙

1 Answers

1
votes

in config/environments/production.rb change config.serve_static_assets = false to be true. But remember to turn it to off on actual production machine. Thin, unicorn etc. are not fr serving static files. You should use apache or nginx in front of your app server to load balance multiple instances of app server and serve static files.

ALL CREDITS TO user rubish