linux - Varnish Error: vcl.load /etc/varnish/default.vcl failed -


on executing command

sudo service varnish reload 

i;m getting following error:

nish@styx:~$ sudo service varnish reload  * reloading http accelerator varnishd          connection failed (localhost:1234) error: vcl.load fc6eef74-6802-4f71-987f-7e6f2bbd8405 /etc/varnish/default.vcl failed 

my /etc/default/varnish looks like:

start=yes nfiles=131072 memlock=82000 instance=$(uname -n) daemon_opts="-a :80 \              -t localhost:1234 \              -f /etc/varnish/default.vcl \               -s malloc,256m" 

and vcl is:

backend default { .host = "localhost"; .port = "1234";  }  sub vcl_recv {  if (req.restarts == 0) { if (req.http.x-forwarded-for) {     set req.http.x-forwarded-for =     req.http.x-forwarded-for + ", " + client.ip; } else {     set req.http.x-forwarded-for = client.ip; }  }  if (req.request != "get" &&    req.request != "head" &&    req.request != "put" &&    req.request != "post" &&    req.request != "trace" &&    req.request != "options" &&    req.request != "delete") {      /* non-rfc2616 or connect weird. */      return (pipe);  }  if (req.request != "get" && req.request != "head") {      /* deal , head default */      return (pass);  }  if (req.http.authorization || req.http.cookie) {      /* not cacheable default */      return (pass);  }  return (lookup);  }   sub vcl_pipe {  # note first request backend have  # x-forwarded-for set.  if use x-forwarded-for , want  # have set requests, make sure have:  # set bereq.http.connection = "close";  # here.  not set default might break broken web  # applications, iis ntlm authentication.  return (pipe); }   sub vcl_pass {  return (pass);  }   sub vcl_hash {  hash_data(req.url);  if (req.http.host) {      hash_data(req.http.host);  } else {      hash_data(server.ip);  }  return (hash); }  sub vcl_hit {  return (deliver); }  sub vcl_miss {  return (fetch); }  sub vcl_fetch {  if (beresp.ttl <= 0s ||      beresp.http.set-cookie ||      beresp.http.vary == "*") {     /*      * mark "hit-for-pass" next 2 minutes      */     set beresp.ttl = 120 s;     return (hit_for_pass);  }  return (deliver); }  sub vcl_deliver {  return (deliver); }  sub vcl_error {  set obj.http.content-type = "text/html; charset=utf-8";  set obj.http.retry-after = "5";  synthetic {" <?xml version="1.0" encoding="utf-8"?> <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en"  "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html> <head>  <title>"} + obj.status + " " + obj.response + {"</title> </head> <body>  <h1>error "} + obj.status + " " + obj.response + {"</h1>  <p>"} + obj.response + {"</p>  <h3>guru meditation:</h3>  <p>xid: "} + req.xid + {"</p>  <hr>  <p>varnish cache server</p> </body> </html> "};  return (deliver); }  sub vcl_init { return (ok); }  sub vcl_fini { return (ok); } 

could please tell me why i'm getting error , how can fix this? thanks

in default.vcl need change:

backend default { .host = "localhost"; .port = "8080";  } 

or port

varnish should on apache or nginx (backend)


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -