Some of the Varnish features include:
* A modern design
* VCL - a very flexible configuration language
* Load balancing with health checking of backends
* Partial support for ESI
* URL rewriting
* Graceful handling of “dead” back-ends
Varnish Installation:
To use the varnish repository under Ubuntu Linux, open up the terminal and type following commands
curl http://repo.varnish-cache.org/debian/GPG-key.txt | apt-key add -Varnish Configuration:
echo "deb http://repo.varnish-cache.org/debian/ $(lsb_release -s -c) varnish-2.1" >> /etc/apt/sources.list
apt-get update
apt-get install varnish
Varnish has a concept of “backend” or “origin” servers. A backend server is the server providing the content Varnish will accelerate.
First task is to tell Varnish where it can find its content. Start your favorite text editor and open the varnish default configuration file (/etc/varnish/default.vcl).
Somewhere in the top there will be a section that looks a bit like this.:
backend default {
.host = "127.0.0.1";
.port = "8080";
}
Varnish can have several backends defined and can you can even join several backends together into clusters of backends for load balancing purposes.
Now, you also need to setup your web-server to listen on port '8080' and restart your web server.
Finally, you also need to start your varnish server using command ..
varnishd -a :80 -b localhost:8080 -T localhost:8090 -s file,/var/lib/varnish/poison/vanish.cache,2G
-a :80 defines the port for Varnish to run on.
-b localhost:8080 defines the port and host of the webserver you want to cache
-T localhost:8090 defines the port and host for the Varnish terminal to run in
-s file,/var/lib/varnish/poison/vanish.cache,4G defines the cache file, and the size limit.
Above is very simple varnish setup, check out the varnish documentation for more detail and complex setup.
2 comments:
I had this error when using curl. any ideas?
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2442 100 2442 0 0 2273 0 0:00:01 0:00:01 --:--:-- 5856
gpg: no writable keyring found: eof
gpg: error reading `-': general error
gpg: import from `-' failed: general error
@mcwood - Change "curl http://repo.varnish-cache.org/debian/GPG-key.txt | apt-key add -" to "curl http://repo.varnish-cache.org/debian/GPG-key.txt | sudo apt-key add -" (note the addition of "sudo").
Post a Comment