Setting up Varnish for Drupal on CentOS 6

Varnish has an offical repository so let’s add it to Yum as outlined on

Set Varnish to start on system boot

Setup DAEMON_OPTS in /etc/sysconfig/varnish, something like below. It will be commented out by default:

Edit the default.vcl file. We use the following for Drupal, which Four Kitchens kindly made available.

Now update your web server to serve from port 8080, and restart the server and varnish.

Download and enable the drupal varnish module:

Add something like the following to settings.php:

Hopefully the site is now using Varnish, you can get some good stats using the varnishlog and varnishstat programs that are included with Varnish.

Setting up memcached with Drupal 7 on Centos 6

Firstly get access to RPMForge repositories. Next install memcached:

Check memcache stats:

Configure memcache:

Configuration details for memcache can be found here

Install the PECL memcached extension for PHP

Install the memcache drupal module and configure the website via settings.php

You don’t need to enable the module unless you want a stats UI.

Edit your site’s settings.php, adding something like the following:

Truncate the cache table, clear the cache and check that the cache table stays empty when you load some pages. Check the memcache stats and see that data is going into the cache.

Hopefully it’s working now!


Drupal Memcache module –

Configuring Memcache from the memcache wiki –


Installing RPMForge repositories on CentOS

By default CentOS Yum has a pretty poor selection of packages compared to something like Debian. So it can be a good idea to add RPMForge to get access to more up to date packages.

Now choose the appropriate repository for the CentOs version and architecture:

Install the repo:

You should now have access to a heap more packages via Yum.