← Back to articles

Setting up Debian with Varnish as internet proxy

Varnish claims to be "10 times faster than squid" but isn't built to be a general internet proxy — so I chained it with Squid on a Debian box for my cable modem. The full setup, step by step.

Tedd

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.

\t

  1. Install Debian on a box.

\t 2. Install Squid and Varnish. apt-get install squid varnish

\t 3. 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

client_db off \t 4. Edit /etc/default/varnish and set

_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). \t 5. Restart Squid and Varnish: /etc/init.d/squid restart /etc/init.d/varnish restart

\t 6. On your client computer set your HTTP PROXY server for HTTP (not HTTPS) to debianserverip port 8080.

image

Written by Tedd · Oslo, Norway

Updated 5 Aug 2010

Follow the journal via RSS