I’ve just installed Nginx with W3 Total Cache (with minify turned off) on my VPS & it’s looking good, but I’ve noticed sites that have it combined with Varnish are super fast & I wanted to give it a go.
I’m not a novice at ssh/bash, but I don’t know a huge amount. I thought I’d try to install it anyway. So I added the source to aptitude since DH version of Varnish is only at 1.* and I wanted 2.1. All installed fine & I set up Varnish to listen to port 80 where Nginx is sending to.
The problems start here. What host should it listen to? ‘localhost’ doesn’t seem to work (errors in varnishlog), neither does 127.0.0.1. Using my sites domain name or IP address seems to work, when I kill Varnish (pkill varnishd) and run it again using:
sudo varnishd -a /etc/varnish/default.vcl -s malloc,100M -a :8080
Then visit my site via http://example.com:8080 with varnishlog running it seems to accept the connection & serve the page. However if I swap all my settings so that Varnish is listening to port 81, and change my varnishd command to output on port 80, then swap my nginx install to send on port 81 (restarting nginx too) I get bupkis… Nothing, just a big fat ‘httpd_bad_conf’ error.
Having Varnish isn’t essential, but I’d love to be able to have it running as it seems to improve site speed quite a bit when running it on port 8080.
If anyone has any ideas how this might be set up I’d love to hear them, it’s officially driven me mad for 24 hours now (no, I haven’t slept) & the guys at Dreamhost have been amazing at helping as much as they are able too, but since it is 3rd party they can’t help any further.
Thanks for any help someone might be able to give in advance. (PS. Sorry about the essay)