Varnish config help

I'm working on speeding up our drupal(pressflow) website and would like to get varnish working, but seem to be finding some config difficulties. I'm hoping that someone here might have the expertise.

I have been following the instructions here, and get some predictable results but it is still causing some problems.

I am running a dedicated server (Debian Etch) with Plesk installed. This means that my normal Debian config files are slightly different. Here's what I've done:

  1. Apache is installed and works. Varnish is installed and works (as in it starts up).

  2. I've set /etc/apache2/ports.conf to Listen 8080

  3. I've set my /etc/apache2/sites-available/default to start with:

    NameVirtualHost *:8080
    <VirtualHost *:8080>
    ...

  4. I have set /etc/default/varnish to be on port 80 (changed from 6081) and my RAM is 512MB in the DEAMON_OPTS line.

  5. I have set my /var/www/vhosts/domain/conf/httpd.include to have

    <VirtualHost myIPaddress:8080>
            ServerName   vhost.domain.name:8080
    ...

  6. APC is setup and working (although my apc.shm_size=33 not 256).

  7. /etc/varnish/default.vcl is configured as per here.

  8. cacherouter is installed and configured correctly and the reverse proxy settings are in settings.php

So, if I go to "http://vhost.domain.name" I get my content, and the firefox Live HTTP headers show that it is being served via Varnish. But, the address shown in the browser gets 8080 appended to it (eg. http://vhost.domain.name:8080) and any link followed from the page bypasses Varnish.

Can anyone point out where I've gone wrong? My guess is that it's something to do with the virtual hosting setup, but I can't see where I need to change things.

Thanks in advance

Login to post comments

ServerName

gchaix's picture
gchaix - Wed, 2009-11-04 19:50

I think the ServerName directive might be incorrect. I think:

ServerName   vhost.domain.name:8080

should be:

ServerName   vhost.domain.name


It depends upon the version

intoxination - Wed, 2009-11-04 20:27

It depends upon the version of Apache. Including :port after ServerName is fine in 2.0+, but not before that. Then you used the port directive:

http://httpd.apache.org/docs/2.2/mod/core.html#servername