简体   繁体   English

Magento 2 CentOS 7 Nginx->清漆-> Apache-> php-fpm重定向循环

[英]Magento 2 CentOS 7 nginx -> varnish -> apache -> php-fpm redirect loop

I've been messing with this for two days and can't find the magical combination. 我已经搞砸了两天了,找不到神奇的组合。

I'm using Magento 2 on CentOS 7 with nginx handling SSL passing off to varnish on port 80 which passes on to apache on 8080 which uses php-fpm. 我在CentOS 7上使用Magento 2,nginx处理SSL传递给端口80上的清漆,该端口传递给8080上使用php-fpm的Apache。 I can get Magento to work with just varnish -> apache -> php-fpm but when I try to introduce nginx in the mix to handle the SSL I get a redirect loop on the entire site. 我可以让Magento仅使用清漆-> apache-> php-fpm,但是当我尝试在混合中引入nginx来处理SSL时,我会在整个站点上得到一个重定向循环。 I've found all kinds of suggestions here and other places but nothing seems to fix it. 我在这里和其他地方找到了各种建议,但似乎没有任何解决方法。

Does anyone have a good guide or any direction on what to do here? 有人在这里做什么有很好的指南或方向吗? Can post configs if necessary. 必要时可以发布配置。

在大多数情况下,请清除您的Cookie来解决问题。

Well, it's hard to say anything without seeing the code and what redirect you're getting exactly. 好吧,如果不看代码以及确切获得的重定向,很难说什么。 But if I would have to bet you're missing an x-forwarded-proto header so PHP assumes you connected with HTTP and sends you to HTTPS. 但是,如果我必须打赌,您会丢失一个x-forwarded-proto头,因此PHP会假定您已连接HTTP,并将您发送到HTTPS。 Try this in your Varnish configuration: 在您的Varnish配置中尝试以下操作:

sub vcl_recv {
  ...
  set req.http.X-Forwarded-Proto = "https";
  ...
}

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

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