I'm trying to set up my nginx.conf to use the asset pipeline in Rails 3.1. I'm using nginx 1.0.10 and Passenger 3.0.11. My nginx.conf looks like this:
server {
listen 80;
server_name .example.com
root /srv/project/public;
passenger_enabled on;
passenger_use_global_queue on;
# Assets shouldn't expire
location ~ ^/assets/ {
gzip_static on;
expires 10y;
add_header Cache-Control public;
add_header Last-Modified "";
add_header ETag "";
}
}
However, when I try to access an asset, I get a 404 error (unless it's accessing the cache, of course). I figured out that adding passenger_enabled on;
into the location ~ ^/assets/
block will fix this problem, but I don't understand why this is needed when it's already specified earlier in the server
block?