Tweak m1.small: Difference between revisions

Jump to navigation Jump to search
 
Line 239: Line 239:


=== vcl ===
=== vcl ===
[http://www.mediawiki.org/wiki/Varnish#A_sample_mediawiki.vcl MediaWiki用のサンプル]をベースにして作成した、現在使用中の vcl (様子見中...)
[http://www.mediawiki.org/wiki/Varnish#A_sample_mediawiki.vcl MediaWiki用のサンプル]をベースにして作成した、現在使用中の vcl (様子見中...) (varnish 2.1版)
  # set default backend if no server cluster specified
  # set default backend if no server cluster specified
  backend default {
  backend default {
Line 503: Line 503:
   return (deliver);
   return (deliver);
  }
  }
(varnish 3.0 版への diff)
<pre>
@@ -13,8 +13,7 @@
# for mod_rpaf logging src IP address
  if (req.restarts == 0) {
    if (req.http.x-forwarded-for) {
-      set req.http.X-Forwarded-For =
- req.http.X-Forwarded-For ", " client.ip;
+      set req.http.X-Forwarded-For = req.http.X-Forwarded-For + ", " + client.ip;
    } else {
      set req.http.X-Forwarded-For = client.ip;
    }
@@ -49,7 +48,7 @@
# for Trick of DirectoryIndex OLD Static contents
  if (req.request == "GET" && req.url ~ "^\/nxhack\/") {
    if (req.url ~ "/$") {
-      set req.url = req.url "index.html";
+      set req.url = req.url + "index.html";
      return (lookup);
    }
  }
@@ -128,7 +127,7 @@
# Force lookup if the request is a no-cache request from the client.
  if (req.http.Cache-Control ~ "no-cache") {
-    purge_url(req.url);
+    ban_url(req.url);
  }
 
# normalize Accept-Encoding to reduce vary
@@ -163,11 +162,11 @@
# Called if the cache has a copy of the page.
sub vcl_hit {
  if (req.request == "PURGE") {
-    purge_url(req.url);
+    ban_url(req.url);
    error 200 "Purged";
  }
 
-  if (!obj.cacheable) {
+  if (!(obj.ttl > 0s)) {
    return (pass);
  }
@@ -206,19 +205,19 @@
    unset beresp.http.set-cookie;
  }
-  if (!beresp.cacheable) {
-    return (pass);
+  if (!(beresp.ttl > 0s)) {
+    return (hit_for_pass);
  }
  if (beresp.http.Set-Cookie) {
-    return (pass);
+    return (hit_for_pass);
  }
  if (req.http.Authorization && !beresp.http.Cache-Control ~ "public") {
-    return (pass);
+    return (hit_for_pass);
  } 
-  if (beresp.cacheable) {
+  if (beresp.ttl > 0s) {
    /* Set how long Varnish will keep it */
#    set beresp.ttl = 1w;
</pre>


==== vcl サンプルのリンク ====
==== vcl サンプルのリンク ====

Navigation menu