简体   繁体   中英

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. 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. 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. Try this in your Varnish configuration:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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