Starting a thin server in production mode does not load my assets

When I load thin like this:

 thin start -e production 

and try to access one of my pages, I get this in the output log:

 cache: [GET /] miss cache: [GET /assets/main-bd1ef4b153740fb69fd615304b87ad0d.css] miss cache: [GET /assets/jqModal-8fa734bf4f58524b2799abd73ab7d34f.css] miss cache: [GET /assets/jquery-544665ba1d5b4f793290421aafed85c9.js] miss cache: [GET /assets/application-00b97aa2429046c0c43802f07b756b46.js] miss 

These files exist in my assets directory in the public section.

I also ran this command:

 RALS_ENV=production rake assets:precompile 

I tried just to access the /public/assets/application.js file in the browser as follows:

 http://localhost:3000/application.js 

This gives me error 404 (although the file exists in /public/assets , but the file can be read when I make a request to the file when the server is in development mode.

Does anyone have any idea?

+8
ruby ruby-on-rails-3 asset-pipeline thin
source share
1 answer

Rails serving static files are disabled by default ( config/environments/production.rb ):

 # Disable Rails static asset server (Apache or nginx will already do this) config.serve_static_assets = false 

The thin server is not configured to serve static assets, so requests for your assets fail.

+13
source share

All Articles