Can't get Varnish working properly, not caching anything. (varnishd is running , status is tick)

drupal.stackexchange https://drupal.stackexchange.com/questions/30732

  •  30-10-2019
  •  | 
  •  

Question

System info:

  • Ubuntu / LAMP
  • Drupal 7.14
  • Varnish 3.0.2
  • Varnish module: 7.x-1.0-beta1
  • http port 80

I have installed Varnish in server.

I started it as:

$ sudo varnishd -f default.vcl -s malloc,1G -T 127.0.0.1:2000

varnishd started and running.

default.vcl details (from this page: https://www.varnish-cache.org/trac/wiki/VarnishAndDrupal)

backend default {
    .host = "127.0.0.1";
    .port = "80";
}


sub vcl_recv {
  // Remove has_js and Google Analytics __* cookies.
  set req.http.Cookie = regsuball(req.http.Cookie, "(^|;\s*)(__[a-z]+$
  // Remove a ";" prefix, if present.
  set req.http.Cookie = regsub(req.http.Cookie, "^;\s*", "");
  // Remove empty cookies.
  if (req.http.Cookie ~ "^\s*$") {
    unset req.http.Cookie;
  }

  // Cache all requests by default, overriding the
  // standard Varnish behavior.
  // if (req.request == "GET" || req.request == "HEAD") {
  //   return (lookup);
  // }
}

sub vcl_hash {
  if (req.http.Cookie) {
    hash_data(req.http.Cookie);
    return (hash);
  }
}

Vanish module enabled.

Following conf added to settings.php

$conf['cache_backends'][] = 'sites/all/modules/varnish/varnish.cache.inc';
$conf['cache_class_cache_page'] = 'VarnishCache';
$conf['page_cache_invoke_hooks'] = FALSE;

Varnish module configuration page screenshot: enter image description here

Performance page screenshot:

enter image description here

Then I browse my site. (as anonymous), repeatedly refresh various pages. Checked stats of varnish

$ varnishtop

enter image description here

apparently it is not receiving any request, not caching anything.

Also check the site on http://www.isvarnishworking.com/ , shows Vanish is not working on the site.

enter image description here


What is wrong?

Thanks for any help.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top