Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails won't serve static files in production

I recently updated my app from 2.3.8 to 3.0.rc, but after a while in development environment I tried the production environment. But now it won't serve static files.

I use standard development and production environment settings, and have no unique gems for either environments. Everything works like a charm in development, but it won't serve static files in production.

Using ruby-1.8.7-p299 and every gem is up to date. Using WEBrick on my server, running rails s -e production -p 3001

Anyone with some solutions or tips to this ?

like image 321
ThoKra Avatar asked Aug 09 '10 20:08

ThoKra


2 Answers

After some extra digging I found a setting in the production.rb file, config.serve_static_assets which was set to false, and since I'm not running apache or nginx the static files where not served. blush

like image 152
ThoKra Avatar answered Nov 18 '22 12:11

ThoKra


For rails 5 you should set environment variable RAILS_SERVE_STATIC_FILES

like image 7
se_pavel Avatar answered Nov 18 '22 14:11

se_pavel