Varnish

Installation
In addition to the basic development tools, there's a few other dependencies:

yum install ncurses-devel pcre-devel libtool python-docutils readline-devel

Download the Varnish source code:

cd /extra/src
wget https://repo.varnish-cache.org/source/varnish-4.1.3.tar.gz
tar zxf varnish-4.1.3.tar.gz
cd varnish-4.1.3

Configure and build it:

./configure
make

If you want, you can run the tests before installing:

cd bin/varnishtest
./varnishtest tests/*.vtc

Then install it:

make install

Varnish will now be installed in /usr/local. The varnishd binary is in /usr/local/sbin/varnishd and its default configuration will be /usr/local/etc/varnish/default.vcl.
You can start up varnish to test it out using but you must enable a backend in /usr/local/etc/varnish/default.vcl:

varnishd -f /usr/local/etc/varnish/default.vcl -s malloc,1G -T 127.0.0.1:2000 -a 0.0.0.0:8080

Automatic Startup
There's a number of different ways to get Varnish to start automatically (rc.d/init.d script, rc.local, xinetd). We're going to use daemontools.
If you haven't already, install daemontools.

Create a directory for the Varnish service:

mkdir -m 1755 /var/service/varnish
cd /var/service/varnish

Create the run script and make it executable:

echo '#!/bin/sh' > run
echo 'exec 2>&1' >> run
echo 'exec varnishd -F -f /usr/local/etc/varnish/default.vcl -s malloc,1G' >> run
chmod 755 run

Our log script comes from John Simpson's:

mkdir -m 755 log
cd log
wget http://qmail.jms1.net/scripts/service-any-log-run
mv service-any-log-run run
chmod 755 run

Finally, add the service to daemontools by creating the symbolic link in /service

ln -s /var/service/varnish /service/varnish

Confirm that the service is running:

svstat /service/varnish /service/varnish/log

Resources
Mobile Device Detection with Varnish

Configure Varnish 3 for Drupal 7

Recent Updates

  • 2 years 2 days ago
  • 2 years 2 days ago
  • 2 years 4 days ago
    php 8.x
  • 2 years 5 days ago
    10.6.7
  • 2 years 1 week ago
    Drop Centos 5/6 stuff