Skip to content

Instantly share code, notes, and snippets.

@kfaustino
Created March 2, 2010 03:16
Show Gist options
  • Save kfaustino/319084 to your computer and use it in GitHub Desktop.
Save kfaustino/319084 to your computer and use it in GitHub Desktop.
nginx rewrite rules for rails page cache in public/cache
# Place the following in the server block
if (-f $request_filename) {
break;
}
if (-f $document_root/cache/$uri/index.html) {
rewrite (.*) /cache/$1/index.html break;
}
if (-f $document_root/cache/$uri.html) {
rewrite (.*) /cache/$1.html break;
}
if (-f $document_root/cache/$uri) {
rewrite (.*) /cache/$1 break;
}
if (!-f $request_filename) {
proxy_pass http://mongrel-pt;
break;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment