Rails 3.1, Unicorn and Apache: static files
I have a post for this problem (yeah it also happened to me), hope it will help.
The key point is to remove ProxyPass / balancer://unicornservers/
pattern, because it would override your Rewrite Rule
Here is my apache server config.
<VirtualHost *:80> ServerName example.org DocumentRoot /dir/of/your/project RewriteEngine On # Redirect all non-static requests to unicorn RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f RewriteRule ^/(.*)$ balancer://unicornservers%{REQUEST_URI} [P,QSA,L] <Proxy balancer://unicornservers> BalancerMember http://127.0.0.1:2007 </Proxy></VirtualHost>
Just from your production.rb code:
# Specifies the header that your server uses for sending files# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
Try to uncomment a line with 'X-Sendfile' header, restart your Unicorn's pool and try again.