Assets not served with RoR 4, Nginx, Unicorn Assets not served with RoR 4, Nginx, Unicorn nginx nginx

Assets not served with RoR 4, Nginx, Unicorn


As it seems from access.log you just hardcoded application.css/.js in your layout. There is no such files in production public folder because of fingerprint name that asset pipeline gives them (look at your example ls output).

You may read about this here.

Fixing your problem really simple. Replace hardcoded links for application.css/.js with this code:

<%= javascript_include_tag "application" %><%= stylesheet_link_tag "application" %>


Adding to the answer of Sergey Moiseev

Try fetching the assets directly with the url /assets/javascripts/application-d65a0eaefe6ca2eef9400045f94ab52b.js.If it doesnt work the your issue is in nginx rather than rails.

Also please check whether you are fetching the file with right fingerprint. In this case check whether its application-d65a0eaefe6ca2eef9400045f94ab52b.js or someother application.js with a different fingerprint. I got a similar issue with multiple servers.


For me, the root path was wrong in my nginx config, and I was experiencing this exact issue. Reference: https://stackoverflow.com/a/25341195/2544629