How to purge Varnish cache

Valic —  August 10, 2011 — 3 Comments

If you’re new varnish user, this is some words about varnish:

Varnish is an HTTP accelerator designed for content-heavy dynamic web sites. Unlike other HTTP accelerators, such as squid, which began as a cache on the client, or Apache2, which is mainly an origin server, Varnish was designed from the ground up as an HTTP accelerator..

Now I will show you how to purge all the cache without restarting the daemon.
The following coomand will do this for you:

varnishadm -T url.purge .*


If you discovered that proxying your webserver with varnish breaks PhpMyAdmin I’ve got the solution:

Problem is that the backend webserver, apache2 or nginx doesn’t even know it’s running behind another software.

Varnish does a completely normal request to webserver. Most times this isn’t any problem at all.

PhpMyAdmin tries to be “smart” and figure out its absolute URL and I run the apache2 or nginx backend on port 80.

The solution is to force an URL.

Add the following line to ““, changing the obvious:

$cfg['PmaAbsoluteUri'] = '';



Assuming you have varnish installed on your server and you started to catch the pages on it.Your webserver is now missing the hits to your pages.

Well, that is great for your webserver load, but not too good for your statistics analysis, because /var/log/apache/access_log will miss the hit.

Configure varnishncsa:

We’ll use varnishncsa to get the logs that awstats will be able to analyse like:

varnishncsa [?a] [?b] [?C] [?c] [?D] [?d] [?f] [?I regex] [?i tag] [?n varnish_name] [?P file] [?r file] [?V] [?w file] [?X regex] [?x tag]

Add this line in the /etc/rc.local file:

Continue Reading…

Varnish is a web accelerator. Its mission is to sit in front of a web server an cache the content. It makes your web site go fast.
In this mode, Varnish will stop incomplete HTTP requests from reaching your Apache webserver.

Installing Varnish:

Varnish is distributed in the Debian package repositories, but the version there might be out of date, and  generally recommend using the packages provided by or packages from

To use the repository and install varnish, do the following:

Change Varnish settings:

1. First change the default port.  Edit /etc/default/varnish:

Continue Reading…

Page 1 of 11