Changes between Version 64 and Version 65 of DevelopmentServer


Ignore:
Timestamp:
09/23/11 13:36:55 (5 years ago)
Author:
chris
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DevelopmentServer

    v64 v65  
    9696Make it listen on port 80 and have 256M RAM and also have the management interface on port 81, apache need it's configuration changing so it listens on port 8080. 
    9797 
    98  
     98Varnish 3.0 configuration: 
     99 
     100{{{ 
     101backend default { 
     102    .host = "127.0.0.1"; 
     103    .port = "8080"; 
     104    .connect_timeout = 600s; 
     105    .first_byte_timeout = 600s; 
     106    .between_bytes_timeout = 600s; 
     107} 
     108acl purge { 
     109  "localhost"; 
     110  "127.0.0.1"; 
     111} 
     112 
     113sub vcl_recv { 
     114 
     115    # remove all cookies 
     116    unset req.http.Cookie; 
     117 
     118    ## Pass cron jobs and server-status 
     119    if (req.url ~ "cron.php") { 
     120      return (pass); 
     121    } 
     122    if (req.url ~ ".*/server-status$") { 
     123      return (pass); 
     124    } 
     125 
     126    # Normalize the Accept-Encoding header 
     127    # as per: http://varnish-cache.org/wiki/FAQ/Compression 
     128    if (req.http.Accept-Encoding) { 
     129      if (req.url ~ "\.(jpg|png|gif|gz|tgz|bz2|tbz|mp3|ogg)$") { 
     130        # No point in compressing these 
     131        remove req.http.Accept-Encoding; 
     132      } elsif (req.http.Accept-Encoding ~ "gzip") { 
     133        set req.http.Accept-Encoding = "gzip"; 
     134     } elsif (req.http.Accept-Encoding ~ "deflate") { 
     135        set req.http.Accept-Encoding = "deflate"; 
     136      } else { 
     137        # unkown algorithm 
     138        remove req.http.Accept-Encoding; 
     139      } 
     140    } 
     141 
     142    ## Default request checks 
     143    if (req.request != "GET" && 
     144    req.request != "HEAD" && 
     145    req.request != "PUT" && 
     146    req.request != "POST" && 
     147    req.request != "TRACE" && 
     148    req.request != "OPTIONS" && 
     149    req.request != "DELETE" && 
     150    req.request != "PURGE") { 
     151    # Non-RFC2616 or CONNECT which is weird. 
     152    return (pipe); 
     153    } 
     154    if (req.request != "GET" && req.request != "HEAD" && req.request != "PURGE") { 
     155    # We only deal with GET, PURGE and HEAD by default 
     156    return (pass); 
     157    } 
     158 
     159    if (req.http.Authorization) { 
     160          # Not cacheable by default 
     161          return (pass); 
     162    } 
     163 
     164    # Check the incoming request type is "PURGE", not "GET" or "POST" 
     165    if (req.request == "PURGE") { 
     166      # Check if the ip coresponds with the acl purge 
     167      if (!client.ip ~ purge) { 
     168      # Return error code 405 (Forbidden) when not 
     169        error 405 "Not allowed."; 
     170      } 
     171      # purge all objects from cache that match the incoming url and host 
     172      #ban("req.url == " + req.url " && req.http.host == " + req.http.host); 
     173      # purge all objects from cache that match the incoming url 
     174      #ban("req.url = " + req.url); 
     175      ban("req.http.host == " + req.http.host + "&& req.url == " + req.url); 
     176      # Return a http error code 200 (Ok) 
     177      error 200 "Purged."; 
     178      } 
     179 
     180    # Grace to allow varnish to serve content if backend is lagged 
     181    #set obj.grace = 5m; 
     182    set req.grace = 30s; 
     183 
     184    return (lookup); 
     185} 
     186 
     187sub vcl_fetch { 
     188    unset beresp.http.set-cookie; 
     189    return (deliver); 
     190} 
     191 
     192sub vcl_deliver { 
     193  if (obj.hits > 0) { 
     194    set resp.http.X-Varnish-Cache = "HIT"; 
     195  } 
     196  else { 
     197    set resp.http.X-Varnish-Cache = "MISS"; 
     198  } 
     199  return (deliver); 
     200} 
     201}}} 
    99202 
    100203== Piwik ==