如何在其他服务器上设置清漆? [英] How to set up varnish on different server?

查看:79
本文介绍了如何在其他服务器上设置清漆?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何使用清漆来缓存位于不同服务器上的网站吗?

I'd like to know how to use varnish to cache website that is in different server?

我有使用Magento CE的网站,已经安装了松节油扩展程序,并且有其他专用服务器.我已在专用服务器上成功安装了varnish,如何配置varnish以告知需要缓存位于其他服务器中的网站,应在何处插入服务器ip,我只找到了将varnish安装在同一服务器上的教程.

I have my website that uses Magento CE, I have already installed turpentine extension and I have different dedicated server. I successfully installed varnish on dedicated server, how to configure varnish to tell that I need to cache website that's in different server, where should insert server ip, I only found varnish tutorials where it's installed in the same server.

推荐答案

只需创建一个指向您的Web服务器ip或域名的后端. 这里是提供了healtcheck的示例.

Just create a backend that points at your webservers ip or domainname. Here a example with provided healtcheck.

probe healthcheck_webserver {
    .url = "/";
    .interval = 5s;
    .timeout = 1s;
    .window = 5;
    .threshold = 3;
    .expected_response = 200;
}

backend webserver {
   .host = "xxx.xxx.xxx.xxx";
   .port = "THEPORTTHATAPACHELISTENSTO";
   .probe =  healthcheck_webserver;
}

当然不要忘记在sub vcl_recv中使用此后端:

And ofcourse dont forget to use this backend in sub vcl_recv:

if (req.http.host ~ "yourdomain.com") 
{
    set req.backend = webserver;
}

这篇关于如何在其他服务器上设置清漆?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆