我在Scientific Linux 6.4(64bit)上使用Varnish-3.0.5: $ rpm -q varnish varnish-3.0.5-1.el5.centos.x86_64 $ cat /etc/redhat-release Scientific Linux release 6.4 (Carbon) $ uname -a Linux XXX.XXX.XXX 2.6.32-358.23.2.el6.x86_64 #1 SMP Wed Oct 16 11:13:47 CDT 2013 x86_64 x86_64 x86_64 GNU/Linux $ curl XXX.XX.XX.XXX <html> <head> <title>Page Unavailable</title> <style> body { background: #303030; text-align: center; color: white; } #page { border: 1px […]
我一直在研究一些用于Varnish 3.x的VCL文件的例子,而且我偶然发现了这个问题,这让我挠头: sub vcl_recv { … if (req.request != "GET" && req.request != "HEAD" && req.request != "PUT" && req.request != "POST" && req.request != "TRACE" && req.request != "OPTIONS" && req.request != "DELETE") { return (pipe); } … } 基本上,我不明白pipe道到后端未知请求会有什么意义? 这是为了万一一些奇怪的Web应用程序/协议,所以它会工作? 为什么pipe这个请求比“传递”它更好呢? 如果有人可以解释这件作品的用例,我很乐意。
我在我的centos服务器上安装了清漆,但我没有得到任何更多的性能,我的网站在安装前7秒加载,安装后仍然是7秒, 问题是什么? sub vcl_recv { remove req.http.X-Forwarded-For; set req.http.X-Forwarded-For = client.ip; if(req.http.cookie ~ "userID" || req.url ~ "^/administrator" || req.url ~ "^/component/banners" || req.request == "POST") { return (pass); } if(req.http.x-logged-in == "False" && req.request != "POST"){ unset req.http.cookie; } if (req.http.Accept-Encoding) { if (req.url ~ "\.(jpg|jpeg|png|gif|gz|tgz|bz2|tbz|mp3|ogg|swf)$") { remove req.http.Accept-Encoding; } elsif (req.http.Accept-Encoding ~ "gzip") […]
“清漆”文档指出,默认情况下,“清漆”在端口6081上进行了configuration,这对于testing目的而言是非常有用的。 https://www.varnish-cache.org/docs/trunk/tutorial/putting_varnish_on_port_80.html 我正在运行多个虚拟主机,当我熟悉Varnish的时候,我想保持它:6081。 我将我的default.vcl .host更改为localhost:80 我假设我可以通过:6081testing清漆,在默认80端口的情况下监听后端服务器,而世界其他地方仍然会继续接收非清漆版本,就像通常在端口80上那样。 但是,我不断收到以下错误:“错误503后端抓取失败” 我可能做错了什么? 我经历了教程,一切都按照教程的指示进行。
在configurationVarnish 4时,我对vcl_recv内部的短路感兴趣,但是我不想跳过builtin.vcl(néedefault.vcl)VCL逻辑 。 例如,给定这个VCL伪代码: sub vcl_recv { if (somecondition1) { set some_thing; return (hash); # Return from cache if present, or fetch from the backend } if (somecondition2) { set some_other_thing; return (hash); # Return from cache if present, or fetch from the backend } // … return (pass); # Skip cache, fetch from the […]
我只是想validation我使用光油的设置。 我有500 GB的磁盘空间专用的机器,我要caching的对象将是巨大的(〜500 MB)的大小。 我正在使用像这样的默认configuration。 DAEMON_OPTS="-a :80 \ -T localhost:6082 \ -f /etc/varnish/default.vcl \ -u varnish -g varnish \ -S /etc/varnish/secret \ -s file,/var/lib/varnish/varnish_storage.bin,80%" 可以使用80%的磁盘空间来清漆吗? 从caching服务中使用80%的500 GB磁盘大小是否会对性能产生影响? 另外,我看到清漆文档提到Tebibytes的大小,所以我不认为大小在这里是一个问题。 可以validation一下吗?
为什么在Varnish 4.0中,我看不到在响应中设置的自定义标头? sub vcl_recv { // disable varnish for now return (pass); } sub vcl_backend_response { set beresp.http.X-Backend = "my_custom_hostname"; return (deliver); } 它曾经工作过很多次,(在3.x或者在nginx后端没有http2,不知道是哪个因素)。 你知道是什么原因导致我无法在http响应中看到我的X-Backend自定义标题? 谢谢。
是否可以configurationVarnish 4来caching所有内容,而不pipe它是什么? 我尝试了这里提到的: http : //www.atomictag.com/2016/04/25/varnish-cache-all/,但是我的命中率仍然很低。 如果这是可能的话,我可以configurationVarnish来每隔15分钟从后端刷新caching。 我知道这不是最好的做法,但是如果我可以提高网站的加载速度,我可以为我的网站访问者提供15分钟的内容。 清漆服务器有32 GB的RAM,但只有8 GB的使用。 我configuration了-malloc,25G。
默认情况下,varnishncsalogging命中和未命中。 因为我已经在我的后端服务器日志中logging错过了,所以我只希望在varnishncsa中logging命中以消除重复并保持日志文件的大小。 有没有人设法做到这一点? 我在Ubuntu 12.04 Server x64上运行Varnish 3.0.2。
所有进入Varnish的POST请求都以GET方式发送到后端。 因此,我收到所有POST请求的503错误网关。 GET请求正常工作。