为什么我需要指定passenger_enabled两次?

我试图设置我的nginx.conf在Rails 3.1中使用资产pipe道。 我使用nginx 1.0.10和Passenger 3.0.11。 我的nginx.conf如下所示:

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 ""; } } 

但是,当我尝试访问资产时,我得到一个404错误(当然,除非它正在访问caching)。 我想通过增加passenger_enabled on; 进入location ~ ^/assets/ block会解决这个问题,但是我不明白为什么在server块的前面已经指定了这个选项?

根据乘客开发者的说法, 这是一个nginx问题 ,需要在每个location块指定passenger_enabled on