gpt4 book ai didi

wordpress - 使用 Varnish 代理 WordPress(在 WPEngine 上)

转载 作者:太空宇宙 更新时间:2023-11-03 13:36:36 27 4
gpt4 key购买 nike

我有一个通过 SSL 服务的站点,该站点位于我管理的服务器上。我还使用 WPEngine 来提供我的博客(因为我不想自己运行 WordPress 安装)。该博客页面当前在没有 HTTPS 的情况下提供服务。

为了让我的所有 URL 都显示在我的顶级域中,我使用 Varnish 将对 mytoplevelsite.com/blog 的请求代理到我的 WPEngine 安装。

如果 WPEngine 上没有 SSL 证书,这一切都很好。然而,当我试图让它与 SSL 一起工作时,我得到了一个 301 重定向循环。

我的 vcl 看起来像这样:

backend default {
.host = "127.0.0.1";
.port = "8080"; # apache is listening here
}

backend blog {
.host = "wpengine-ip-address";
.port = "80";
}

sub vcl_recv {
if (req.url ~ "^/blog" && req.http.Host ~ "(.*)mytoplevelsite.com") {
set req.backend = blog;
if ((req.url ~ "^/blog/wp-content") || (req.url ~ "^/blog/wp-includes")) {
set req.http.host = "mysite.wpengine.com";
set req.url = regsub(req.url, "^/blog", "");
}
return(pass);
}
}

在 WPEngine 中,我安装了 SSL 并将 mytoplevelsite.com/blog 设置为通过 HTTPS 提供服务,但这会导致 301 重定向循环。当我运行:curl -Li https://mytoplevelsite.com/blog 我一遍又一遍地看到这个:

HTTP/1.1 301 Moved Permanently
Date: Thu, 23 Jun 2016 13:26:07 GMT
Server: Apache
Location: http://mytoplevelsite.com/blog/
Content-Length: 311
Content-Type: text/html; charset=iso-8859-1

HTTP/1.1 301 Moved Permanently
Server: nginx
Content-Type: text/html
Location: https://mytoplevelsite.com/blog/
X-Type: default
Content-Length: 178
Accept-Ranges: bytes
Date: Thu, 23 Jun 2016 13:26:07 GMT
X-Varnish: 1087407254
Age: 0
Via: 1.1 varnish
Connection: keep-alive

... repeat until timeout

关于我可以在这里做什么的任何想法?

最佳答案

如果您有共享 SSL(我假设是通配符),请使用 sFTP 将 key 和证书文件上传到您的 _wpeprivate 文件夹,然后获得他们的支持,将证书的副本放在他们的服务器上。(这是托管在不同服务器上的任何子域站点的正确方法。)

通过 my.wpengine.com 用户门户强制使用 SSL。 Overview > SSL > 单击 SSL 并强制全部为 SSL

以上述推荐方法以外的任何其他方式强制使用 SSL 通常会导致重定向循环。

关于wordpress - 使用 Varnish 代理 WordPress(在 WPEngine 上),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37993797/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com