繁体   English   中英

如何使用 HTTPS 配置带有清漆缓存的 Magento 2

[英]How can configure the Magento 2 With Varnish Cache with HTTPS

谢谢你看这个。

我有一个 Magento 2.1.8 网站,它将使用这个https://aws.amazon.com/marketplace/pp/B007OUYR4Y Amazon AMI 在 Amazon EC2 上运行。

我已经优化了 Magento 2 网站上的所有内容,但没有得到正确的结果。

我曾尝试使用 Varnish 缓存,但它不适用于 HTTPS。

任何人都有一个想法,如何使用带有 HTTPS 的清漆来优化网站速度。

Varnish Cache 本身就使用 HTTPS。 您需要在 Varnish 前面部署一个 SSL 终结器,例如HitchHAProxy等,最好使用 PROXY 协议。

在我的设置中,我使用 NGINX 作为代理来处理 http 和 https 请求,然后使用 Varnish 作为后端,因此 NGINX 处理所有 SSL 证书。

这是我的 NGINX ssl 模板的示例:

server {
    listen  server-ip:443 ssl;
    server_name example.com www.example.com;
    ssl_certificate  /home/user/conf/web/ssl.example.com.pem;
    ssl_certificate_key  /home/user/conf/web/ssl.example.com.key;

    location / {
      proxy_pass  http://varnish-ip:6081;
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $remote_addr;
      proxy_set_header X-Forwarded-Proto https;
      proxy_set_header X-Nginx on;
      proxy_redirect     off;
    }

    location @fallback {
        proxy_pass  http://varnish-ip:6081;
    }


}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM