Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've been following this guide which uses this default.vcl. However, when starting Varnish I get the following error:

 * Starting HTTP accelerator                                                                                                                                                                                                                                           [fail] 
storage_malloc: max size 1024 MB.
Message from VCC-compiler:
Expected '(' got ';'
(program line 341), at
(input Line 43 Pos 22)
                purge;
---------------------#
Running VCC-compiler failed, exit 1
VCL compilation failed

Which means that there is something wrong with purge here:

sub vcl_hit {
        if (req.request == "PURGE") {
                purge;
                error 200 "Purged.";
        }
}

I don't see anything wrong, can someone explain?

Thanks!

share|improve this question
    
Can you please post the complete config file? –  Paul Apr 7 '12 at 14:34
    
Hi Paul, you can find it here: github.com/ewanleith/Wordpress-Server-Configuration-Files/blob/… –  FLX Apr 7 '12 at 14:50
1  
What version of Varnish are you running (varnishd -V)? purge is only available in Varnish 3. In Varnish 2.x the equivalent was set obj.ttl = 0s; –  cyberx86 Apr 7 '12 at 15:47
    
Ah, that was it, I installed Varnish 3 from varnish-cache.org/installation/ubuntu now :) –  FLX Apr 7 '12 at 16:13

1 Answer 1

up vote 1 down vote accepted

The code block you have used is perfectly valid - in fact I use a nearly identical one with my Varnish setup (and I presume many others do as well).

As the error suggests there is a problem with purge. Since purge was only introduced in Varnish 3.x, if you are using a prior version of Varnish (2.x) the command will be unrecognised, and compilation will fail. You can determine your version of Varnish by running varnishd -V.

If you are using a previous version of Varnish, and are unable to upgrade, the equivalent command is set obj.ttl = 0s;.

Varnish maintains up-to-date repositories for Ubuntu/Debian and RHEL/CentOS distributions on their download page.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.