KfWiki : Varnish

HomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register

Revision [2006]

Most recent edit made on 2008-10-16 08:49:21 by WikiAdmin

Additions:
v2.0 style (plus ip + url filter)
.host = "127.0.0.1";
.port = "801";
acl localip {
"192.168.13.10";

if (client.ip ~ localip) {
if (req.url ~ "^/admin") {
error 403 "Hmm...";
}
}
}
V1.x style




Revision [1984]

Edited on 2008-10-04 14:20:28 by WikiAdmin

Additions:

pipe;


Deletions:
sub checkurl {
call checkurl;
lookup;




Revision [1983]

Edited on 2008-10-04 13:57:48 by WikiAdmin

Additions:
sub checkurl {
call checkurl;




Revision [1982]

Edited on 2008-10-04 13:20:17 by WikiAdmin

Additions:

error 403 "Access restricted.";
}


Deletions:

error 403 "Access restricted.";
}




Revision [1981]

Edited on 2008-10-04 13:19:55 by WikiAdmin

Additions:
acl clientnet {
"1.2.3.4";
"2.3.4.5";
# filter access to certain url
if (req.url ~ "^/admin") {
if (!client.ip ~ clientnet) {
error 403 "Access restricted.";
}




Revision [1904]

Edited on 2008-08-20 02:29:43 by WikiAdmin

Additions:

lookup;
There are three keywords with vcl file:
pipe: check the next rule
pass: do not cache
lookup: cache




Revision [1903]

The oldest known version of this page was edited on 2008-08-20 02:28:24 by WikiAdmin
HomePage » WebServer » Varnish


Varnish

Get it from http://varnish.projects.linpro.no/

Install
Just do a source install. If you distribution keeps things up to date, you may be able to get it via yum / aptitute.

Config
For Fedora / Redhat, one can copy the following files:
redhat/varnish.sysconfig -> /etc/sysconfig/varnish
redhat/varnish.initrc -> /etc/init.d/varnish

Create the group & user varnish, then create the cache directory specified in /etc/sysconfig/varnish. Edit the ports specified in that config file, and change the init script to use /usr/local/sbin/varnish. Varnish should start up fine.

Log
Varnish logs with separate process. The init script is available from redhat/varnishlog.initrc. Once started, one can use varnishlog to examine the log database.

default.vcl
Varnish may require some tweaking for dynamic content. In my test, if the URL doesn't change, the content is not refreshed. My jsp file simple reports the current time including the second, and that does not work very well. I had to tell varnish not to cache jsp files -

backend default {
		set backend.host = "127.0.0.1";
		set backend.port = "8080";
}

# This prevents varnish from caching *.jsp and *.jspx
sub vcl_recv {
		if (req.request == "GET" && req.url ~ "\.(jsp|jspx)$") {
				pass;
		}
}

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki
Page was generated in 0.5899 seconds