Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

According to the passenger devs, it's an nginx issue, and passenger_enabled on needs to be specified in every location block.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.