Articles of 漆

Varnish在清除时运行VCC编译器失败

我一直在使用这个default.vcl 这个指南 。 但是,当开始清漆,我得到以下错误: * Starting HTTP accelerator [fail] storage_malloc: max size 1024 MB. Message from VCC-compiler: Expected '(' got ';' (program line 341), at (input Line 43 Pos 22) purge; ———————# Running VCC-compiler failed, exit 1 VCL compilation failed 这意味着在这里清除是有问题的: sub vcl_hit { if (req.request == "PURGE") { purge; error 200 "Purged."; } } […]

清漆cachingCLI清除单个文件?

这些示例工作来清除(第一个)文件夹和域根 varnishadm -S /etc/varnish/secret -T localhost:6082 "ban req.http.host == mysite.com && req.url ~ ^/fold/.*$" varnishadm -S /etc/varnish/secret -T localhost:6082 "ban req.http.host == mysite.com && req.url ~ ^/.*$" 我怎样才能清除一个文件“index2.html”(例如) “… && req.url〜^ / index2.html $” 以上不给出错误信息,但不起作用。 编辑:重新testing显示我原本有一个错字,当试图工作W /单个文件。 格式(张贴在这里)确实工作。

如何查看varnish 3.0.5中的n_lru_nuked?

我试图监视清漆caching驱逐,似乎无法find如何查看清漆3.0.5上的n_lru_nuked计数器。 varnishstat没有find柜台: $ varnishstat -f n_lru_moved,n_lru_nuked 0+21:44:54 Hitrate ratio: 1 1 1 Hitrate avg: 0.8292 0.8292 0.8292 31943 . . n_lru_moved – N LRU moved objects 在3.0.5中监控caching逐出的方法是不同的吗?

光油开始时ACL很大

我有一个清漆configuration文件,看起来像这样: backend web1 { .host = "1.2.3.1" ; … } backend web2 { .host = "1.2.3.2" ; … } backend web3 { .host = "1.2.3.3" ; … } backend web4 { .host = "1.2.3.4" ; … } director default_director round-robin { { .backend = web1; } { .backend = web2; } { .backend = web3; […]

Varnish VCL – 正则expression式评估

过去几天我一直在为这个问题苦苦挣扎: 基本上,我想发送给客户浏览器一个cookie的formsfoo[sha1oftheurl]=[randomvalue]当且仅当cookie尚未设置。 例如,如果客户端浏览器请求“/page.html”,则HTTP响应将如下所示: resp.http.Set-Cookie = "foo4c9ae249e9e061dd6e30893e03dc10a58cc40ee6=ABCD;" 那么,如果相同的客户端请求“/index.html”,HTTP响应将包含一个标头: resp.http.Set-Cookie = "foo14fe4559026d4c5b5eb530ee70300c52d99e70d7=QWERTY;" 最后,客户端浏览器将有2个cookie: foo4c9ae249e9e061dd6e30893e03dc10a58cc40ee6=ABCD foo14fe4559026d4c5b5eb530ee70300c52d99e70d7=QWERTY 现在,这本身并不复杂。 下面的代码是这样的: import digest; import random; ##This vmod does not exist, it's just for the example. sub vcl_recv() { ## We compute the sha1 of the requested URL and store it in req.http.Url-Sha1 set req.http.Url-Sha1 = digest.hash_sha1(req.url); set req.http.random-value = random.get_rand(); } […]

你如何去除清漆?

我有一个网站,目前正在使用Varnish来cachingHTTP请求,但是由于多种原因,这样做的弊大于利。 我的问题是,我找不到一个方法来阻止所有的http请求通过它。 如果我停止varnishd服务,然后整个网站下降。 清漆statup选项表明正在使用端口2000,但没有任何东西似乎绑定到Apache。 Apacheconfiguration指向标准端口80。 这是CentOS盒子,Apache 2.2.3,Varnish 2.0.6

看到两个varnish过程是正常的吗?

我在RHEL5服务器上运行Varnish 3.x。 开始清漆后, ps ax |grep varnish得到: [root@ip-… ec2-user]# ps ax |grep varnish 2747 ? Ss 0:00 /usr/sbin/varnishd -P /var/run/varnish.pid -a :80 -T localhost:6082 -f /etc/varnish/idea-int.vcl -u varnish -g varnish 2748 ? Sl 0:00 /usr/sbin/varnishd -P /var/run/varnish.pid -a :80 -T localhost:6082 -f /etc/varnish/idea-int.vcl -u varnish -g varnish 和/var/run/varnish.pid显示2747。 这是正常的吗?

在Varnish 4.0中设置默认TTL?

我是Varnish的新手,我在Debian Wheezy上运行v4.0。 我想设置一个默认的TTL跨4周的caching(非常静态的内容)。 从阅读文档,我认为答案是在我的VCL文件的某处设置一个default_ttl选项。 我已经search了文档,但只能find一个参考 。 我发现这个问题,但我认为答案必须是过时的,因为它不适合我。 有人可以澄清如何在Varnish 4.0中做到这一点? 更新:这是我的configuration文件(除了我指出在本地主机的后端除了Varnish 4.0的默认): backend default { .host = "127.0.0.1"; .port = "8080"; } sub vcl_backend_fetch { set obj.ttl = 4w; } sub vcl_recv { # Happens before we check if we have this in cache already. # # Typically you clean up the request here, removing cookies […]

如何基于主机+path在光油散列?

我想在Varnish中使用哈希指示器来redirect所有请求的同一个URL 没有查询参数到同一台服务器: 例如, http://example.com/foo/bar?a=1 http://example.com/foo/bar?a=2&b=3 应该哈希到相同的服务器。 我只想散列主机和path 。 这是我的configuration: sub vcl_init { new workers = directors.hash(); workers.add_backend(worker_1, 1); workers.add_backend(worker_2, 1); workers.add_backend(worker_3, 1); } 我知道我需要在这里设置哈希函数: sub vcl_recv { set req.backend_hint = workers.backend(…); } 我应该把什么东西放在主机+path散列,没有查询string?

更换清漆4 503错误

我怎样才能改变清漆503错误? 我如何定制它? 我使用清漆v 4 现在工作 sub vcl_synth { set resp.http.Content-Type = "text/html; charset=utf-8"; set resp.http.Retry-After = "5"; synthetic( {"<!DOCTYPE html> <html> <head> <title>Under Maintenance</title> </head> <body> <h1>Under Maintenance</h1> <p></p> <hr> </body> </html> "} ); return (deliver); }