【问题标题】:How to set up varnish on different server?如何在不同的服务器上设置清漆?
【发布时间】:2014-11-08 16:45:31
【问题描述】:

我想知道如何使用 varnish 来缓存不同服务器中的网站?

我的网站使用 Magento CE,我已经安装了松节油扩展程序,并且我有不同的专用服务器。我在专用服务器上成功安装了varnish,如何配置varnish来告诉我需要缓存不同服务器上的网站,应该在哪里插入服务器ip,我只找到了安装在同一台服务器上的varnish教程。

【问题讨论】:

    标签: magento varnish varnish-vcl


    【解决方案1】:

    您只需在您的

    中指定
    backend .. {
    

    将您的第二台服务器的 IP 地址 + 端口部分。

    【讨论】:

      【解决方案2】:

      只需创建一个指向您的网络服务器 ip 或域名的后端。 这是一个提供健康检查的示例。

      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 中使用这个后端:

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-10-19
        • 1970-01-01
        • 1970-01-01
        • 2011-10-07
        • 2018-11-22
        • 2012-10-14
        • 2017-12-18
        • 2015-02-28
        相关资源
        最近更新 更多