Rails can\'t load (404 error) CSS & JS files on production but has no problem loading them in development.
I\'m using Capistrano for deployment and running Rails
I fixed this problem by running this command:
RAILS_ENV=production rake assets:precompile
Reference: http://guides.rubyonrails.org/asset_pipeline.html
My environment is Nginx
+ Unicorn
+ Rails4
The error message looks like your Rails app is getting the request for a static file. Rails 3 does not serve static files by default, since the webserver can do so much better. You should check your webserver's configuration. It should be configured to first look, if a static file exists in the public directory for a request and only forward the request to the Rails app, if there's no static file.
Alternatively, you can enable Rails to also serve static files with config.serve_static_assets = true
in config/environments/production.rb. However, this is not recommended in production, since you really shouldn't waste processing resources of a Rails app just for serving static files. Better tell the webserver to do so.