I'm just experimenting with Varnish & Drupal 7 now and am getting stuck here:
http://groups.drupal.org/pantheon/mercurywiki#config-apache-varnish
I want to set this up in a environment on debian that uses both D6 & D7 sites. I'm not looking to use pressflow, but understand that this shouldn't be required with the changes in D7.
3a) The whole /etc/apache2/ports.conf
Listen 80
Listen 443
Listen 8080
b) The top of /etc/apache2/sites-available/default
ServerName dev.openconcept.ca
NameVirtualHost *:8080
...
c) for D7:
$ sudo mkdir -p /var/lib/varnish/d7 | sudo chown varnish.varnish /var/lib/varnish/d7
d) Now for /etc/default/varnish
Why are we replacing
INSTANCE=$(uname -n)
With (in my instance):
INSTANCE=d7
I'm assuming that it's so it uses one common directory. Is this for one site or could it be used for many. The inline docs state:
Default varnish instance name is the local nodename. Can be overridden with
the -n switch, to have more instances on a single server.
Telling folks to use 25% of their RAM is good, but many folks may not actually know. This helps:
$ free -m
$ cat /proc/meminfo | grep MemTotal
The main change to this file however is just ensuring that you've started with Alternative 2 and modified it to listen on port 80:
DAEMON_OPTS="-a :80 \
-T localhost:6082 \
-f /etc/varnish/default.vcl \
-S /etc/varnish/secret \
-s file,/var/lib/varnish/$INSTANCE/varnish_storage.bin,1G"
e) Many folks may already have this set as something like this for all of their drupal sites:
<Directory /var/www/dm7>
Options -Indexes FollowSymLinks Includes
AllowOverride All
order allow,deny
allow from all
php_value memory_limit 64M
</Directory>
f) Now I like to test apache before restarting it, but sadly I'm getting a warning:
$ sudo /usr/sbin/apache2ctl -t
[Wed Feb 09 11:21:49 2011] [warn] default VirtualHost overlap on port 80, the first has precedence
If I put NameVirtualHost *:8080
at the top of my D7 apache config file etc/apache2/sites-available/dm7
then it works without errors.
I'm also expecting that there is an error here that Varnish isn't telling me as every time I restart varnish I get:
$ sudo /etc/init.d/varnish restart
Stopping HTTP accelerator: varnishd failed!
Starting HTTP accelerator: varnishd.
g & h) This didn't work (as it isn't going to the right file) but right now it's not even pointing to the right place:
$ curl -I http://d7.dev.openconcept.ca
HTTP/1.1 200 OK
Date: Wed, 09 Feb 2011 16:39:39 GMT
Server: Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny9 with Suhosin-Patch mod_ssl/2.2.9 OpenSSL/0.9.8g
Last-Modified: Mon, 13 Apr 2009 14:52:22 GMT
ETag: "175883c-2d-46770dc9b3580"
Accept-Ranges: bytes
Content-Length: 45
Vary: Accept-Encoding
Content-Type: text/html
I'm just looking for some pointers to move this along. I feel like I'm closer to a solution now, but still not working.
Comments
port 80 conflict
You can't have both apache and varnish trying to listen at port 80, take that Listen 80 out of the ports.conf so that varnish can take over.
Thanks.
Took me a while to get back to this, but I'm definitely making more progress.
We're getting odd, intermittent errors where pages are Forbidden and then with a refresh or two they are back again.
--
OpenConcept | Twitter @mgifford | Drupal Security Guide