Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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;

  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
up vote 1 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

Your Answer


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.