Tagged: Varnish

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://github.com/mattiasgeniar/varnish-3.0-configuration-templates.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){
return(restart);
}
Advertisements