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 using nginx to serve a sinatra based project which has fairly static content..

I've tried to combine this: http://articles.slicehost.com/2008/5/27/ubuntu-hardy-nginx-rails-and-thin

with the proxying solution offered elsewhere on this site: How to set up Nginx as a caching reverse proxy?

Coming up with...

https://gist.github.com/1167754

But for some reason, nothing is ever written to cache. I've made sure nginx owns the folder used for caching, and there are no errors in the error.log..

Apologies for the semi-reproduced content, but I couldn't find a good guide to combining the two.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

"Set-Cookie"

Nginx version 0.8.44+ does not cache upstream responses with Set-Cookie header. Make sure your backend does not issue it.

"If"

"If is Evil", rewrite your config to smth like

location / {
  # ...
}

location ~ \.(ico|css|js|gif|jpe?g|png)$ {
  expires max;
}

Locations match a path, not arguments. That's why I omitted the last part of your regular expression that was supposed to match a query string.

share|improve this answer
    
Thanks. Removing "set cookies" solved it. –  minikomi Aug 29 '11 at 2:08

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.