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

varnishd started and running.

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

backend default {
    .host = "";
    .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) {
    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.


By default, Varnish is not working on port 80 (and in this case it could not be either since your Apache is occupying that port). You should configure your Apache to listen to another port, then use that port for your backend setup in Varnish. You should also configure Varnish to listen to port 80.

To debug, you should try to figure out what port your Varnish is listening to now and browse using that port, then you should see traffic in varnishtop.

The reason I'm being vague on the varnish configuration is that I have only used Varnish on CentOS which reads in the startup defaults from /etc/sysconfig/varnish - since you are using Ubuntu you should try to find out where that default configuration is being kept on your system. A fair starting point might be the /etc/init.d/varnishd script which might give some clues.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.