Varnish is a great http accelerator, “10 times faster than squid”. This partially due to its use of modern computer architecture. Although its main purpose is as a web server accelerator it can also be used as a traditional internet accelerator/cache. The web page FAQ says it requires a lot of work though.
But there is a simpler solution by having it cooperate with Squid. Not the most elegant solution, but for my cable modem it will be more than enough.
- Install Debian on a box.
- Install Squid and Varnish.
apt-get install squid varnish - Edit /etc/squid/squid.conf (this is actually optional, but recommended):
Add the lines:
cache_dir ufs /var/spool/squid 10 2 4
forwarded_for off - Edit /etc/default/varnish and set
- Restart Squid and Varnish:
/etc/init.d/squid restart
/etc/init.d/varnish restart - On your client computer set your HTTP PROXY server for HTTP (not HTTPS) to debianserverip port 8080.
client_db off
DAEMON_OPTS=”-a :6081 \
to
DAEMON_OPTS=”-a :8080 \
And
-b localhost:8080 \
to
-b localhost:3128 \
Add the line: -f /etc/varnish/default.vcl \
after -b line.
Set how much disk space you want to use for cache in the line:
-s file,/var/lib/varnish/$INSTANCE/varnish_storage.bin,1G”
Note: For 32-bit systems keep it low (~1GB).
Testing with Ubuntu Lucid 10.04 amd64 shows me this didn’t work too well. I tested Squid directly, and that works, but for some reason Varnish doesn’t want to play ball:
Error 503 Service Unavailable
Service Unavailable
Guru Meditation:
XID: 1309427290
Varnish cache server
Check varnishlog to see what is causing the stop. Default Varnish-config should work just fine for pass-through with caching. Hmmm… I see I’ve got “-f /etc/varnish/default.vcl \” as well in my working copy. Updating post. 🙂