In my server, I have varnish setup. I use wordpress and installed w3 total cache plugin. I have set that plugin to purge my varnish (varnish 3) cache. But its not working! In my syslog, there are some errors like show below... please help me!
Mar 22 21:29:40 kadupul varnishd[3755]: CLI telnet 113.59.222.126 58833 77.81.240.177 6082 Rd GET / HTTP/1.1
Mar 22 21:29:40 kadupul varnishd[3755]: CLI telnet 113.59.222.126 58833 77.81.240.177 6082 Wr 101 Unknown request. Type 'help' for more info. all comm$
Mar 22 21:29:40 kadupul varnishd[3755]: CLI telnet 113.59.222.126 58833 77.81.240.177 6082 Rd Host: 77.81.240.177:6082
Mar 22 21:29:40 kadupul varnishd[3755]: CLI telnet 113.59.222.126 58833 77.81.240.177 6082 Wr 101 Unknown request. Type 'help' for more info. all comm$
Mar 22 21:29:40 kadupul varnishd[3755]: CLI telnet 113.59.222.126 58833 77.81.240.177 6082 Rd User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:11.$
Mar 22 21:29:40 kadupul varnishd[3755]: CLI telnet 113.59.222.126 58833 77.81.240.177 6082 Wr 101 Unknown request. Type 'help' for more info. all comm$
Mar 22 21:29:40 kadupul varnishd[3755]: CLI telnet 113.59.222.126 58833 77.81.240.177 6082 Rd Accept: text/html,application/xhtml+xml,application/xml;$
Mar 22 21:29:40 kadupul varnishd[3755]: CLI telnet 113.59.222.126 58833 77.81.240.177 6082 Wr 101 Unknown request. Type 'help' for more info. all comm$
Mar 22 21:29:40 kadupul varnishd[3755]: CLI telnet 113.59.222.126 58833 77.81.240.177 6082 Rd Accept-Language: en-us,en;q=0.5
Mar 22 21:29:40 kadupul varnishd[3755]: CLI telnet 113.59.222.126 58833 77.81.240.177 6082 Wr 101 Unknown request. Type 'help' for more info. all comm$
Mar 22 21:29:40 kadupul varnishd[3755]: CLI telnet 113.59.222.126 58833 77.81.240.177 6082 Rd Accept-Encoding: gzip, deflate
Mar 22 21:29:40 kadupul varnishd[3755]: CLI telnet 113.59.222.126 58833 77.81.240.177 6082 Wr 101 Unknown request. Type 'help' for more info. all comm$
Mar 22 21:29:40 kadupul varnishd[3755]: CLI telnet 113.59.222.126 58833 77.81.240.177 6082 Rd Connection: keep-alive
Mar 22 21:29:40 kadupul varnishd[3755]: CLI telnet 113.59.222.126 58833 77.81.240.177 6082 Wr 101 Unknown request. Type 'help' for more info. all comm$
Mar 22 21:30:01 kadupul CRON[3782]: (root) CMD (env MAILTO= SHELL=/bin/bash /usr/local/sbin/bfd -q)
My default.vcl (I have also added the ip 77.81.240.177 as the varnish server in the w3 total cache plugin) :
backend default {
.host = "77.81.240.177";
.port = "8080";
}
acl purge {
"localhost";
"127.0.0.1";
"77.81.240.177";
}
sub vcl_recv {
# Add a unique header containing the client address
remove req.http.X-Forwarded-For;
#set req.http.X-Forwarded-For = client.ip;
set req.http.X-Forwarded-For = req.http.rlnclientipaddr;
if (req.request == "PURGE") {
if (!client.ip ~ purge) {
error 405 "Not allowed.";
}
return(lookup);
}
if (req.http.Accept-Encoding) {
#revisit this list
if (req.url ~ "\.(gif|jpg|jpeg|swf|flv|mp3|mp4|pdf|ico|png|gz|tgz|bz2)(\?.*|)$") {
remove req.http.Accept-Encoding;
} elsif (req.http.Accept-Encoding ~ "gzip") {
set req.http.Accept-Encoding = "gzip";
} elsif (req.http.Accept-Encoding ~ "deflate") {
set req.http.Accept-Encoding = "deflate";
} else {
remove req.http.Accept-Encoding;
}
}
if (req.url ~ "\.(gif|jpg|jpeg|swf|css|js|flv|mp3|mp4|pdf|ico|png)(\?.*|)$") {
unset req.http.cookie;
set req.url = regsub(req.url, "\?.*$", "");
}
#if (req.url ~ "(\?|&)(utm_(campaign|medium|source|term)|adParams|client|cx|eid|fbid|feed|ref(id|src)?|v(er|iew))=”) {
# set req.url = regsub(req.url, “\?.*$”, “”);
#}
if (req.http.cookie) {
if (req.http.cookie ~ "(wordpress_|wp-settings-)") {
return(pass);
} else {
unset req.http.cookie;
}
}
}
sub vcl_fetch {
if (req.url ~ "wp-(login|admin)" || req.url ~ "preview=true" || req.url ~ "xmlrpc.php") {
return (hit_for_pass);
}
if ( (!(req.url ~ "(wp-(login|admin)|login)")) || (req.request == "GET") ) {
unset beresp.http.set-cookie;
set beresp.ttl = 2h;
}
if (req.url ~ "\.(gif|jpg|jpeg|swf|css|js|flv|mp3|mp4|pdf|ico|png)(\?.*|)$") {
set beresp.ttl = 30d;
} #else {
# set beresp.do_esi = true;
#}
}
sub vcl_deliver {
# multi-server webfarm? set a variable here so you can check
# the headers to see which frontend served the request
# set resp.http.X-Server = "server-01";
if (obj.hits > 0) {
set resp.http.X-Cache = "HIT";
} else {
set resp.http.X-Cache = "MISS";
}
}
sub vcl_hit {
if (req.request == "PURGE") {
set obj.ttl = 0s;
error 200 "OK";
}
}
sub vcl_miss {
if (req.request == "PURGE") {
error 404 "Not cached";
}
}