Puma: Puma server does not serve static files for my app

Created on 9 Jul 2013  路  4Comments  路  Source: puma/puma

Hi, I'm trying to deploy a Rails app in 2.3 version using nginx + Puma.

It works fine except I all the requests under my public directory have a 404 as result.
In development occurs the same. Every request for a media asset (js, css, etc) are not working.

Maybe I am forgetting something basic, I'm not expert in this issues. Please, can anybody help me to fix this? I'm looking forward change my Passenger default server to Puma!!

Most helpful comment

In Rails 5, you can use RAILS_SERVE_STATIC_FILES=true rails s -e production.
The key in production.rb is now config.public_file_server.enabled.

All 4 comments

Puma doesn't have anything internal for serving files, so that would be coming from rails doing that. You'll have to check out the rails configuration. I know rails doesn't serve files in production mode, so you might double check that it's starting in dev mode.

You can serve them out by mapping the paths directly into Nginx / Apache or use config.serve_static_assets = true which worked for me.

In Rails 5, you can use RAILS_SERVE_STATIC_FILES=true rails s -e production.
The key in production.rb is now config.public_file_server.enabled.

Like to point out, its better to use nginx or sorts to serve static assets rather than make rails do it. Since everything to points to say it is a overhead on rails to serve assets. Also worth mentioning nginx etc manages cache and is meant for this job.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

premist picture premist  路  3Comments

nateberkopec picture nateberkopec  路  3Comments

mvz picture mvz  路  4Comments

edmz picture edmz  路  3Comments

knzudgt picture knzudgt  路  4Comments