Commit 244a582f authored by Anders Berg's avatar Anders Berg

Cleaned up some code in the general section. Used the ** marker for bolding...

Cleaned up some code in the general section. Used the ** marker for bolding the questions. Added a internal ref to the installation doc so we could use best-practice referencing. Added som stuff to FAQ/configuration.

git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4786 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 6d71a5eb
......@@ -13,7 +13,7 @@ VCL is an acronym for Varnish Configuration Language. In a VCL file, you config
We are working on documenting VCL. The `WIKI <http://varnish-cache.org/wiki/VCLExamples>`_ contains some examples.
Please also see "man 7 vcl".
Please also see ``man 7 vcl``.
**How do I load VCL file while Varnish is running?**
......
......@@ -28,90 +28,90 @@ Varnish is free software and is licenced under a modified BSD licence. Please re
How...
======
... How much RAM/Disk do I need for Varnish ?
**How much RAM/Disk do I need for Varnish?**
That depends on pretty much everything.
That depends on pretty much everything.
I think our best current guidance is that you go for a cost-effective
RAM configuration, something like 1-16GB, and a SSD disk.
I think our best current guidance is that you go for a cost-effective
RAM configuration, something like 1-16GB, and a SSD disk.
Unless you positively know that you will need it, there is
little point in spendng a fortune on a hand-sewn motherboard
that can fit several TB in special RAM blocks, rivetet together
by leftover watch-makers in Switzerland.
Unless you positively know that you will need it, there is
little point in spendng a fortune on a hand-sewn motherboard
that can fit several TB in special RAM blocks, rivetet together
by leftover watch-makers in Switzerland.
On the other hand, if you plot your traffic in Gb/s, you probably
need all the RAM you can afford/get.
On the other hand, if you plot your traffic in Gb/s, you probably
need all the RAM you can afford/get.
... How can I limit Varnish to use less RAM ?
**How can I limit Varnish to use less RAM?**
You can not. Varnish operates in Virtual Memory and it is up to the
kernel to decide which process gets to use how much RAM to map the
virtual address-space of the process.
You can not. Varnish operates in Virtual Memory and it is up to the
kernel to decide which process gets to use how much RAM to map the
virtual address-space of the process.
Where...
========
... Can I find varnish for my operating system ?
**Can I find varnish for my operating system?**
We know that Varnish has been packaged for Debian, Ubuntu, RHEL,
Centos, (Open)SuSE, Gentoo and FreeBSD, possibly more. Check whatever
packagemanager you use.
We know that Varnish has been packaged for Debian, Ubuntu, RHEL,
Centos, (Open)SuSE, Gentoo and FreeBSD, possibly more. Check whatever
packagemanager you use. Or read :ref:`Installing Varnish on your computer <install-doc>`.
Can I...
========
... Can I use Varnish as a client-side proxy ?
**Can I use Varnish as a client-side proxy?**
No. Varnish needs all backends configured in the VCL. Look at squid
instead.
No. Varnish needs all backends configured in the VCL. Look at squid
instead.
... Can I run Varnish on a 32bit system ?
**Can I run Varnish on a 32bit system?**
Yes, recently somebody even claimed to run Varnish on his N900 mobile
phone recently, but if you have the choice, go 64 bit from the start.
Yes, recently somebody even claimed to run Varnish on his N900 mobile
phone recently, but if you have the choice, go 64 bit from the start.
Varnish is written to use Virtual Memory and on a 32bit system that
really cramps your style, and you will have trouble configuring more
than 2 GB of storage.
Varnish is written to use Virtual Memory and on a 32bit system that
really cramps your style, and you will have trouble configuring more
than 2 GB of storage.
... Can I run Varnish on the same system as Apache ?
**Can I run Varnish on the same system as Apache?**
Yes, and many people do that with good success.
Yes, and many people do that with good success.
There will be competition for resources, but Apache is not particular
good at using RAM effectively and Varnish is, so this synergy usually
more than compensates for the competition.
There will be competition for resources, but Apache is not particular
good at using RAM effectively and Varnish is, so this synergy usually
more than compensates for the competition.
... Can I run multiple Varnish on the same system ?
**Can I run multiple Varnish on the same system?**
Yes, as long as you give them different TCP ports and different ```-n```
arguments, you will be fine.
Yes, as long as you give them different TCP ports and different ``-n``
arguments, you will be fine.
... Can I cache multiple vhosts with one Varnish ?
**Can I cache multiple vhosts with one Varnish?**
Yes, that works right out of the box.
Yes, that works right out of the box.
... Can I see what is cached in Varnish ?
**Can I see what is cached in Varnish?**
That is not possible for several reasons. A command to list
all the contents of a Varnish cache with millions of objects would
bring your Varnish to a standstill while it traverses the index.
That is not possible for several reasons. A command to list
all the contents of a Varnish cache with millions of objects would
bring your Varnish to a standstill while it traverses the index.
Besides, the output is a lot less useful than you might think.
Besides, the output is a lot less useful than you might think.
... Can I use Varnish to do HTTPS ?
**Can I use Varnish to do HTTPS?**
Not at present, and while we keep an eye on this, there are no
current plans to add HTTPS support, until we can find a way where
it adds significant value, relative to running a stand-alone
HTTPS proxy such as ngnix or pound.
Not at present, and while we keep an eye on this, there are no
current plans to add HTTPS support, until we can find a way where
it adds significant value, relative to running a stand-alone
HTTPS proxy such as ngnix or pound.
... Can Varnish load balance between multiple backends ?
**Can Varnish load balance between multiple backends?**
Yes, you need VCL code like this::
Yes, you need VCL code like this::
director foobar round-robin {
{ .backend = { .host = "www1.example.com; .port = "http"; } }
......@@ -127,58 +127,72 @@ Can I...
Why ...
=======
... Varnish does not cache things, all requests hit the backend
**Why does it look like Varnish sends all requests to the backend? I thought it was a cache?**
The number one cause is cookies, the ```default.vcl``` will
not cache anything if the request has a ```Cookie:``` header
or the if the backend sends a ```Set-Cookie:``` header.
There are 2 common reasons for this:
1. The object's ``ttl expired``. A common situation is that the backend does not set an expiry time on the requested image/file/webpage, so Varnish uses the default TTL (normally 120s).
2. Your site uses ``cookies``:
* By default, varnish will not cache ``responses`` from the backend that come with a ``Set-Cookie``: header.
* By default, varnish will not serve ``requests`` with a ``Cookie:`` header, but pass them to the backend instead. Check out [wiki:VCLExamples these VCL examples] on how to make varnish cache cookied/logged in users sanely.
Number two cause is authentication, same thing.
... Why are regular expressions case-sensitive ?
**Why are regular expressions case-sensitive?**
Some HTTP headers, such as ```Host:``` and ```Location:```
contain FQDN's which by definition is not case-sensitive. Other
HTTP headers are case-sensitive, most notably the URLs. Therefore
a "one size fits all" solution is not possible.
Some HTTP headers, such as ``Host:`` and ``Location:``
contain FQDN's which by definition is not case-sensitive. Other
HTTP headers are case-sensitive, most notably the URLs. Therefore
a "one size fits all" solution is not possible.
In previous releases, we used the POSIX regular expressions
supplied with the operating system, and decided, because the
most common use of regexps were on ```Host:``` headers, that
they should not be case-sensitive.
In previous releases, we used the POSIX regular expressions
supplied with the operating system, and decided, because the
most common use of regexps were on ```Host:``` headers, that
they should not be case-sensitive.
From version 2.1.0 and forward, we use PCRE regular expressions,
where it *is* possible to control case-sensitivity in the
individual regular expressions, so we decided that it would
probably confuse people if we made the default case-insentive.
(We promise not to change our minds about this again.)
From version 2.1.0 and forward, we use PCRE regular expressions,
where it *is* possible to control case-sensitivity in the
individual regular expressions, so we decided that it would
probably confuse people if we made the default case-insentive.
(We promise not to change our minds about this again.)
To make a PCRE regex case insensitive, put ```(?i)``` at the start::
To make a PCRE regex case insensitive, put ``(?i)`` at the start::
if (req.http.host ~ "?iexample.com$") {
...
}
See the [http://www.pcre.org/pcre.txt PCRE man pages] for more information.
See the `PCRE man pages <http://www.pcre.org/pcre.txt>`_ for more information.
... Why does the ```Via:``` header say 1.1 in Varnish 2.1.x ?
**Why does the ``Via:`` header say 1.1 in Varnish 2.1.x?**
The number in the ```Via:``` header is the HTTP protocol version
supported/applied, not the softwares version number.
The number in the ``Via:`` header is the HTTP protocol version
supported/applied, not the softwares version number.
... Why did you call it *Varnish* ?
**Why did you call it *Varnish*?**
Long story, but basically the instigator of Varnish spent a long
time staring at an art-poster with the word "Vernisage" and ended
up checking it in a dictionary, which gives the following three
meanings of the word:
Long story, but basically the instigator of Varnish spent a long
time staring at an art-poster with the word "Vernisage" and ended
up checking it in a dictionary, which gives the following three
meanings of the word:
r.v. var·nished, var·nish·ing, var·nish·es
r.v. var·nished, var·nish·ing, var·nish·es
1. To cover with varnish.
2. To give a smooth and glossy finish to.
3. To give a deceptively attractive appearance to; gloss over.
The three point describes happens to your backend system when you
put Varnish in front of it.
The three point describes happens to your backend system when you
put Varnish in front of it.
How...
======
**How do I instruct varnish to ignore the query parameters and only cache one instance of an object?**
This can be achieved by removing the query parameters using a regexp::
sub vcl_recv {
set req.url = regsub(req.url, "\?.*", "");
}
.. _install-doc:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Installing Varnish on your computer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
......@@ -27,6 +29,7 @@ being:
**CentOS/RedHat 5.4 - RPM files**
We try to keep the lastest version available as prebuildt RPMs (el4 & el5) on `SourceForge <http://sourceforge.net/projects/varnish/files/>`_.
Varnish is included in the `EPEL <http://fedoraproject.org/wiki/EPEL>`_ repository. **BUT** unfortunatly we had a syntax change in Varnish 2.0.6->2.1.X. This means that we can not update Varnish in `EPEL <http://fedoraproject.org/wiki/EPEL>`_ so the latest version there is Varnish 2.0.6. In the future (EPEL6) we should be available with Varnish 2.1.X or higher.
**Debian/Ubuntu - DEB files**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment