Rails won't serve static files in production
Asked Answered
W

2

12

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 ?

Wesley answered 9/8, 2010 at 20:49 Comment(0)
W
21

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

Wesley answered 9/8, 2010 at 22:30 Comment(1)
Nice. Hopefully you've just saved many persons from such future blushes :).Grimaldi
P
9

For rails 5 you should set environment variable RAILS_SERVE_STATIC_FILES

Pericranium answered 28/5, 2018 at 14:19 Comment(1)
This came in handy when debugging a webpacker problem: RAILS_SERVE_STATIC_FILES=1 bin/rails sPhineas

© 2022 - 2024 — McMap. All rights reserved.