Configuring Varnish to work with Apache on Ubuntu 14.04 is largely similar to this article covering 12.04.
I just ran through a basic set up on 14.04. The first step is to install Apache and Varnish:
sudo apt-get install varnish apache2
Then we need to configure Varnish to listen on port 80. Edit the file
/etc/default/varnish Find the section begin with “Alternative 2, Configuration with VCL” Make sure it’s uncommented and update the port:
DAEMON_OPTS="-a :80 \
-T localhost:6082 \
-f /etc/varnish/default.vcl \
-S /etc/varnish/secret \
Next we need to adjust Apache to listen on port 8080. Edit
/etc/apache2/ports.conf and change
Listen 80 to
Listen 8080 Then edit
/etc/apache2/sites-enabled/000-default.conf and change
<VirtualHost *:80> to
Finally, restart Varnish and Apache with:
sudo service apache2 restart
sudo service varnish restart
Varnish is now sitting in front of Apache and serving cached content.
Varnish is an HTTP accelerator and a useful tool for speeding up a server, especially during a times when there is high traffic to a site. It works by redirecting visitors to static pages whenever possible and only drawing on the virtual private server itself if there is a need for an active process. This tutorial covers setting up Varnish with Apache on Ubuntu 12.04.