我有以下configuration: Nginx>清漆> Gunicorn> Django 我想caching与同一个网站(移动和networking)的2个版本与清漆。 Gunicorn: WEB: gunicorn_django –bind 127.0.0.1:8181 MOBILE: gunicorn_django –bind 127.0.0.1:8182 Nginx的: WEB: server { listen 80; server_name www.mysite.com; location / { proxy_pass http://127.0.0.1:8282; # pass to Varnish proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } 移动: server { listen 80; server_name m.mysite.com; location / { proxy_pass http://127.0.0.1:8282; # […]
我试图使用Varnish来平衡第三方Web应用程序,而这个第三方应用程序需要“真正”的服务器名称(它似乎是通过后台连接到这个服务器的名字(而localhost不起作用) :()在查询string传递,我也需要故障转移,这意味着我想使用董事,所以我的configuration可以是简单的,将扩展。 以下是我想要做的一个基本示例: sub vcl_pass { set bereq.http.X-Varnish-Backend = bereq.backend.name } 但是,我们已经提出请求后,backend.name只能在beresp中使用。 看起来Varnish并没有决定在 vcl_pass结束之前使用哪个后端,而且在请求被发送到后端之前没有其他的钩子。 它是否正确? 如果是这样,是否有另一种解决scheme(除了固定在Web服务器,我不控制)? 没有循环,即使我在VCL中实现了一个replace的客户端主pipe,它也不会扩展到几台服务器之外。
我想弄清楚如何让后端在特定的注册页面上查看跟踪cookie,但忽略其他人。 目前,我试图使用从后端发送的自定义标头来set beresp.ttl = 0s; 在vcl_fetch里面: if (beresp.http.cache-control ~ "max-age=-30") { set beresp.ttl = 0s; } 但是注册页面仍然阻止后端读取cookie。 在vcl_recv我使用这个方法删除它们: set req.http.Cookie = regsuball(req.http.Cookie, "(^|;\s*)(__[az]+|_ga|_mkto_trk)=[^;]*", ""); set req.http.Cookie = regsub(req.http.Cookie, "^;\s*", ""); if (req.http.Cookie ~ "^\s*$") { unset req.http.Cookie; } 我怎样才能允许cookie在这些特定页面的后端读取? 我假设我需要在vcl_recv创buildexception?
我有一个架构,两个清漆服务器坐在5个站台前。 每个清漆服务器都configuration了一个循环后端导向器,但是在中等到高负载的时候,清漆似乎非常偏向清单中第一个定义的后端。 清漆版本是3.0.5。 如果第一个后端被标记为病态,那么列表中的第二个后端会受到很大的青睐,依此类推。 varnish> backend.list 200 Backend name Refs Admin Probe web1(************,,8080) 102 probe Healthy 8/8 web2(************,,8080) 17 probe Healthy 8/8 web3(************,,8080) 9 probe Healthy 8/8 web4(************,,8080) 17 probe Healthy 8/8 web5(************,,8080) 12 probe Healthy 8/8 VCL的某些部分可能是相关的: probe healthcheck { .request = "GET /LICENSE.txt HTTP/1.1" "Host: **********.co.uk" "Connection: close"; .interval = 120s; .timeout = […]
我在Apache的Varnish + Pound设置上看到很多看似随机的503 Service Unavailable错误。 我不知道从哪里开始或者问题是什么。 我已经在网上search了一大堆,我所尝试的所有build议都没有奏效。 所以下面是我的设置。 清漆configuration DAEMON_OPTS="-a :80 \ -T localhost:6082 \ -f /etc/varnish/default.vcl \ -S /etc/varnish/secret \ -p connect_timeout=2500 \ -p thread_pools=8 \ -p thread_pool_max=2500 \ -p max_restarts=8 \ -s malloc,256m" Varnish VCL backend default { .host = "127.0.0.1"; .port = "8080"; .connect_timeout = 3600s; .first_byte_timeout = 3600s; .between_bytes_timeout = 3600s; […]
我正在玩不同的configuration设置。 目前我在同一台机器上有80端口的Varnish-cache,70端口的Apache2和90端口的Nginx。 Varnish的configuration方式默认与Nginx通信,例如:config .host = "localhost"; .port = "90"; .connect_timeout = 60s; .first_byte_timeout = 300s; .between_bytes_timeout = 300s; .probe = basic; 我的问题是,如果Nginx死了,如何使Varnish fallback到Apache? 使用Apache的Varnish的基本configuration是这样的。 .host = "localhost"; .port = "70" .connect_timeout = 60s; .first_byte_timeout = 300s; .between_bytes_timeout = 300s; .probe = basic; 如果第一个configuration失败,我想触发这个configuration(我不能完全放在单词中,但是,如果Nginx死了,我想清除Ping Apache)。 任何关于configuration的提示或build议都会很有帮助。 谢谢。
我创build了一个解决scheme来托pipeAWS上具有高stream量(> 500个用户)的magento商店。 在access.log中出现HTTP 499错误通常是Varnish。 发生这种情况时,有这种访问权限的用户将面临503。 我不知道什么可能会导致错误499,但我明白它的意义。 我改变了几个参数,但没有成功。 任何想法? 我的/etc/varnish/default.vcl: backend webserver01 { .host = "172.31.30.167"; .port = "80"; .connect_timeout = 10s; .first_byte_timeout = 90s; # .probe = { # .url = "/heartbeat/index.php"; # .timeout = 30 s; # .interval = 15 s; # .window = 6; # .threshold = 3; # } } backend webserver02 […]
在过去的几年中,我们一直运行Varnish作为caching和负载均衡器,在服务于数千个网站的几台Apache服务器之前。 我们还使用monit来确保如果清漆死亡,它会重新启动。 monitrc中的清漆部分如下所示: # Check varnish on port 80 check process varnish with pidfile /var/run/varnishd.pid start program = "/etc/init.d/varnish start" stop program = "/etc/init.d/varnish stop" if failed host 127.0.0.1 port 80 protocol http and request "/monit-check-url" then restart 这至less可以工作3年。 80端口检查偶尔会出现故障,但monit会重新启动清漆,用户通常不会察觉。 但是,在过去的几个星期里,我们看到了这些失败的风险,通常在几个小时的时间里,用户注意到连接失败。 今天特别糟糕。 在系统日志中没有任何线索(这是一个debian框btw)的build议“光油崩溃”部分: https : //www.varnish-cache.org/docs/3.0/tutorial/troubleshooting.html和我们看到的所有有监测端口80检查,然后停止和启动清漆。 另外,我们没有看到带宽的上升或后端Web服务器的点击次数,这表明它在高于正常负载的情况下失败。 我们正在运行光油3.0.3,我升级到3.0.7,但问题仍在继续。 这个箱子没有做任何其他的改变,这个改变与开始的问题是一致的,而且在很长一段时间里漆的configuration没有改变。 有没有人有类似的经验与清漆或有任何解决这个问题的build议? 会不会是某种攻击? 任何帮助或build议非常感谢!
我是新的清漆。 每当我试图通过清漆访问我们的后端,我得到下面的错误: <!DOCTYPE html> <html> <head> <title>503 Backend fetch failed</title> </head> <body> <h1>Error 503 Backend fetch failed</h1> <p>Backend fetch failed</p> <h3>Guru Meditation:</h3> <p>XID: 3</p> <hr> <p>Varnish cache server</p> </body> </html> 我的varnish.vcl如下所示: – vcl 4.0; backend default { .host = "146.88.25.40"; .port = "8080"; } 我也试过设置first_byte_timeout = 60s .connect_timeout = 60s , first_byte_timeout = 60s和.between_bytes_timeout = […]
我有一个部署与Apache 2.2.22服务器后清漆。 我想完成的是用htpasswd保护一个目录的密码,但是对于来自ips的某些用户来说这个访问是不需要authentication的。 AuthType Basic AuthName "test" AuthUserFile /www/.htpasswd Require valid-user order deny,allow deny from all SetEnvIF X-Forwarded-For "1.2.3.4" AllowIP Allow from env=AllowIP Satisfy any 我现在所做的是这样的,这是一个解决方法,但是它正在工作。 如果X-Forwarded-For IP(客户端)是1.2.3.4,那么让他无需validation就可以观看页面。 这个问题是不安全的,客户端可以设置一个X-Forwareded-For标头并绕过authentication。 我已经尝试了Apache RPAF模块: <IfModule rpaf_module> RPAFenable On RPAFsethostname On RPAFproxy_ips 127.0.0.1 varniship </IfModule> 理论上应该限制来自代理的X-Forwarded-For请求,我甚至不确定在这种情况下我需要这个模块,因为代理将总是把X-Forwarded-For客户端IP放在它的后面。 所以要求如下: X-Forwarded-For: <varniship>, clientip 客户可以再次操纵客户。 有一个更好的方法吗?