0

Complete newbie to Varnish so apologies ahead of time if this seems rather silly.

Here's the situation. I have a server with 5 IPs. Using ISPconfig for most tasks but that's probably irrelevant.

I have multiple apache virtual hosts configured across multiple IPs.

The issue is that varnish is putting out a 503, fetch error no backend connection (according to varnishlog) on any of the non-default virtual hosts i.e. ones with a static IP defined in vhosts. Any *:8080 vhosts are working ok. So I'm missing something somewhere. All of the vhost error logs show file does not exist errors though the path looks correct.

Suggestions are much appreciated.

I have of course manually edited all vhost entries and configured them accordingly i.e.

<VirtualHost 00.11.22.33:8080>
      DocumentRoot /var/www/shop.example1.com/web

Here's my vcl config

    backend default {

        .host = "127.0.0.1";
        .port = "8080";
    }

    backend example1 {
          .host = "00.11.22.33";
          .port = "8080";
    }

    backend example2 {
         .host = "11.22.33.44";
          .port = "8080";
    }


    acl purge {
            "localhost";
    }

    sub vcl_recv {

    if (req.http.host ~ "(?i)^(www.)?example1.com")

    {

        set req.http.host = "www.example1.com";
        set req.backend = example1;

    }

    if (req.http.Host ~ "shop\.example2\.com") 
    {

            set req.http.Host = "shop.example2.com";
            set req.backend = example2;


            }
        set req.grace = 2m;

  set req.http.Cookie = regsuball(req.http.Cookie, "(^|;\s*)(_[_a-z]+|has_js)=[^;]*", "");
  set req.http.Cookie = regsub(req.http.Cookie, "^;\s*", "");




if (req.url ~ "/wp-(login|admin|cron)") {
        return (pass);
}


set req.http.Cookie = regsuball(req.http.Cookie, "wp-settings-1=[^;]+(; )?", "");

set req.http.Cookie = regsuball(req.http.Cookie, "wp-settings-time-1=[^;]+(; )?", "");

set req.http.Cookie = regsuball(req.http.Cookie, "wordpress_test_cookie=[^;]+(; )?", "");

if (req.url ~ "wp-content/themes/" && req.url ~ "\.(css|js|png|gif|jp(e)?g)") {

.......
'
Nik
  • 21
  • 1
  • 5
  • Below is an excerpt from the varnish log: `VCL_call c miss fetch 11 FetchError c no backend connection 11 VCL_call c error deliver 11 VCL_call c deliver deliver 11 TxProtocol c HTTP/1.1 11 TxStatus c 503 11 TxResponse c Service Unavailable ` I'm missing something obvious here. – Nik Aug 31 '12 at 16:53

1 Answers1

1

Damn obvious thing of course.

port.conf had:

    NameVirtualHost *:8080
Listen 127.0.0.1:8080

What it needed was:

NameVirtualHost *:8080
Listen 127.0.0.1:8080
Listen my_IP1:8080
Listen my_IP2:8080
Nik
  • 21
  • 1
  • 5
  • You don't need to specify the IPs. You can just `Listen 8080` -- http://httpd.apache.org/docs/2.2/mod/mpm_common.html#listen – Frank Farmer Aug 31 '12 at 18:05