Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Images and assets not working in my production server on rails 3.1.0

I switched my server to production and i cannot get any of my images to load. It all works fine on development mode but when i switched to production it all stopped working i have enabled server_static_assets and still yet nothing works. Any help towards doing this

like image 699
Uchenna Avatar asked Sep 07 '11 21:09

Uchenna


1 Answers

Here are a few problems that you might be having:

1 - Your production configuration may not be correct. This is particularly likely if you started out with an early 3.1 release candidate, and have been updating along the way. The suggested options for production.rb changed quite a bit between rc4 and the 3.1.0 release.

Make sure that your production.rb settings include:

# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = false
# Generate digests for assets URLs
config.assets.digest = true

2 - You may have forgotten to precompile your assets

RAILS_ENV=production rake assets:precompile

3 - You may have forgotten to restart your web server to pick up the changes in production.rb.

like image 105
cailinanne Avatar answered Oct 21 '22 04:10

cailinanne