Advertisement
Guest User

Untitled

a guest
Aug 28th, 2013
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.60 KB | None | 0 0
  1. # This is a basic VCL configuration file for varnish. See the vcl(7)
  2. # man page for details on VCL syntax and semantics.
  3. #
  4. # Default backend definition. Set this to point to your content
  5. # server.
  6. #
  7. backend default {
  8. .host = "127.0.0.1";
  9. .port = "8080";
  10. }
  11. # Drop any cookies sent to Wordpress.
  12. sub vcl_recv {
  13. if (!(req.url ~ "wp-(login|admin)")) {
  14. unset req.http.cookie;
  15. }
  16. }
  17.  
  18. # Drop any cookies Wordpress tries to send back to the client.
  19. sub vcl_fetch {
  20. if (!(req.url ~ "wp-(login|admin)")) {
  21. unset beresp.http.set-cookie;
  22. }
  23. }
  24.  
  25. sub vcl_fetch {
  26. if (req.url ~ "^/phpmyadmin") {
  27. return (hit_for_pass);
  28. }
  29. }
  30.  
  31. #
  32. # Below is a commented-out copy of the default VCL logic. If you
  33. # redefine any of these subroutines, the built-in logic will be
  34. # appended to your code.
  35. # sub vcl_recv {
  36. # if (req.restarts == 0) {
  37. # if (req.http.x-forwarded-for) {
  38. # set req.http.X-Forwarded-For =
  39. # req.http.X-Forwarded-For + ", " + client.ip;
  40. # } else {
  41. # set req.http.X-Forwarded-For = client.ip;
  42. # }
  43. # }
  44. # if (req.request != "GET" &&
  45. # req.request != "HEAD" &&
  46. # req.request != "PUT" &&
  47. # req.request != "POST" &&
  48. # req.request != "TRACE" &&
  49. # req.request != "OPTIONS" &&
  50. # req.request != "DELETE") {
  51. # /* Non-RFC2616 or CONNECT which is weird. */
  52. # return (pipe);
  53. # }
  54. # if (req.request != "GET" && req.request != "HEAD") {
  55. # /* We only deal with GET and HEAD by default */
  56. # return (pass);
  57. # }
  58. # if (req.http.Authorization || req.http.Cookie) {
  59. # /* Not cacheable by default */
  60. # return (pass);
  61. # }
  62. # return (lookup);
  63. # }
  64. #
  65. # sub vcl_pipe {
  66. # # Note that only the first request to the backend will have
  67. # # X-Forwarded-For set. If you use X-Forwarded-For and want to
  68. # # have it set for all requests, make sure to have:
  69. # # set bereq.http.connection = "close";
  70. # # here. It is not set by default as it might break some broken web
  71. # # applications, like IIS with NTLM authentication.
  72. # return (pipe);
  73. # }
  74. #
  75. # sub vcl_pass {
  76. # return (pass);
  77. # }
  78. #
  79. # sub vcl_hash {
  80. # hash_data(req.url);
  81. # if (req.http.host) {
  82. # hash_data(req.http.host);
  83. # } else {
  84. # hash_data(server.ip);
  85. # }
  86. # return (hash);
  87. # }
  88. #
  89. # sub vcl_hit {
  90. # return (deliver);
  91. # }
  92. #
  93. # sub vcl_miss {
  94. # return (fetch);
  95. # }
  96. #
  97. # sub vcl_fetch {
  98. # if (beresp.ttl <= 0s ||
  99. # beresp.http.Set-Cookie ||
  100. # beresp.http.Vary == "*") {
  101. # /*
  102. # * Mark as "Hit-For-Pass" for the next 2 minutes
  103. # */
  104. # set beresp.ttl = 120 s;
  105. # return (hit_for_pass);
  106. # }
  107. # return (deliver);
  108. # }
  109. #
  110. # sub vcl_deliver {
  111. # return (deliver);
  112. # }
  113. #
  114. # sub vcl_error {
  115. # set obj.http.Content-Type = "text/html; charset=utf-8";
  116. # set obj.http.Retry-After = "5";
  117. # synthetic {"
  118. # <?xml version="1.0" encoding="utf-8"?>
  119. # <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  120. # "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  121. # <html>
  122. # <head>
  123. # <title>"} + obj.status + " " + obj.response + {"</title>
  124. # </head>
  125. # <body>
  126. # <h1>Error "} + obj.status + " " + obj.response + {"</h1>
  127. # <p>"} + obj.response + {"</p>
  128. # <h3>Guru Meditation:</h3>
  129. # <p>XID: "} + req.xid + {"</p>
  130. # <hr>
  131. # <p>Varnish cache server</p>
  132. # </body>
  133. # </html>
  134. # "};
  135. # return (deliver);
  136. # }
  137. #
  138. # sub vcl_init {
  139. # return (ok);
  140. # }
  141. #
  142. # sub vcl_fini {
  143. # return (ok);
  144. # }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement