Here's some steps to troubleshoot:
Get Varnish Working on its own:
Your varnishd
should be running with several parameters, here's samples from my Ubuntu Server install (/etc/defaults/varnish
):
-a :6081
public port -- this is the port webbrowsers will use
-T localhost:6082
admin port -- this is used to configure varnish
-f /etc/varnish/default.vcl
initial VCL config file (see below) -- the configuration used when varnish first starts
-s malloc,256m
storage backend -- a 256MB in-memory backend in this case
-S /etc/varnish/secret
path to varnish's admin password file
Turpentine's documentation also mentions these parameters are likely required:
-p esi_syntax=0x2
-p cli_buffer=16384
Here's my sample default.vcl
, this is a barebones config that tells Varnish to proxy requests to 127.0.0.1:80, and wil only be used until Turpentine reconfigures Varnish:
backend default {
.host = "127.0.0.1";
.port = "80";
}
You can verify these settings are in-use by checking the running process: ps aux |grep varnishd
Testing your Varnish config
With varnishd running with the above parameters you should be able to telnet to your admin port (-T
above):
telnet localhost 6082
If you provided -S
above you will be prompted for authorization; use the contents of your secret file. If you can't get in via telnet try removing the -S
parameter to disable authentication (you'll want to re-enabled it later). Once you login you'll be at the varnish console; keep this open.
Setting up Turpentine
I assume you've successfully installed Turpentine in Magento. Go to System -> Configuration
and review these settings:
Varnish Options
- Varnish Version: Set to "Auto" if you don't know the specific version you're using
- Server List: this should exactly match the
-T
parameter for varnishd
-- localhost:6082
in the above example
- Varnish Authentication Key: this should be the key used for
-S
above, or empty if you've disabled authentication
Caching Options
- Backend Host:
localhost
if Magento and Varnish are on the same server, otherwise the Magento host
- Backend Port: Magento's HTTP port (typically 80)
When you save these configs you should see a success or error message. This message indicates that Turpentine was able to generate a new VCL configuration file and make it active in Varnish. To confirm this use your telnet session to run vcl.list
. You should see something like:
vcl.list
200 106
available 4 boot
active 2 ef1a15f2132a599ed26520c94c599e71aa7f5e576afcfca211e6249dcd640ddd
boot
is the default.vcl
above; the second VCL is what Turpentine has generated and has been switched to be active.
- Use
System -> Cache Management
to enable both Varnish Magento caches; flush all caches and logout of the admin panel to ensure everything takes effect.
At this point Turpentine should be up and running. You can run varnishstats
and load your webpage using the -a
port from varnishd
. Reloading the page several times should result in an above-zero Hitrate.
Keep in mind that with this configuration your Turpentine VCL will be lost if varnishd
is restarted (along with cached contents). You can use the Cache Management
page of magento to export a new .acl file to use for the -f
parameter so that it will take effect whenever varnish restarts.