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!!
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.
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.