1

I have properly installed varnish 4. Varnish is on port 80 while apache on port 8080.

After editing /etc/varnish/default.vcl and inside sub vcl_backend_response writting to cache static files:

if (bereq.url ~ “(woff|woff2|jpg|jpeg|png|gif|css|js|less)”) {
set beresp.ttl = 3600s;
}

I get Err_Connection_Refused

I don't understand what I have done wrong?

Aaron
  • 33
  • 2
  • 6

1 Answers1

0

You probably copied the code from somewhere on the internet. There are code styling components out there, that replace quotation marks with other characters.

Please mind, there is a subtle but visible difference between “” and "". Without further error description, you might start and change the quotation marks.

The final result should look like this:

if (bereq.url ~ "(woff|woff2|jpg|jpeg|png|gif|css|js|less)") {
    set beresp.ttl = 3600s;
}
rollstuhlfahrer
  • 3,988
  • 9
  • 25
  • 38
  • Hey rollstuhlfahrer thanks. Since I am a beginner I wanted to ask you For something else. In my website I have dynamic css and js files, which means it they add after .css a =ver+number. How can I cache also those files? – Aaron Jan 15 '18 at 22:37
  • Looks possible, but please open another question for this. And if you are satisfied with the answer, please accept it! – rollstuhlfahrer Jan 15 '18 at 22:38
  • Hey @rollstuhlfahrer stackoverflow wants me to post after 90 min. How can I contact you back? – Aaron Jan 15 '18 at 22:46