Install Notes for Varnish 3.0 Configuration Templates by Mattias Geniar

Mattias Geniar has some in-depth configuration for Varnish. However, the install notes are far from complete. Mine doesn’t even have any install notes. 🙂 So, here is a quick install guide…

# edit /etc/sysconfig/varnish or /etc/default/varnish to change default.vcl to production.vcl

# go to the varnish configuration directory
cd /etc/varnish

# download github repo
git clone git://
cp -a varnish-3.0-configuration-templates/* .
rm -rf varnish-3.0-configuration-templates/

# Rename the files
mv custom.acl.vcl-sample custom.acl.vcl
mv custom.backend.vcl-sample custom.backend.vcl
mv custom.fetch.vcl-sample custom.fetch.vcl
mv custom.recv.vcl-sample custom.recv.vcl

# Remove the extra code (probably other than "backend default")
vim custom.backend.vcl

# done
service varnish start

In production.vcl, in vcl_fetch, please add the following lines just before return (deliver)…

    if (beresp.status != 200) {
        return (hit_for_pass);

In the same file (production.vcl), in vcl_fetch logic, please remove the following code as well…

if (beresp.status >= 500 && beresp.status <= 599){

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s