Magento 2 - SSL 配置后的 502 Bad Gateway

Magento 2 - 502 Bad Gateway after ssl configuration

我正在使用 comodo 提供的 ssl 证书,在我看来配置正确,因为我的网站正确显示了 https。但是,当我使用 ssl 访问我的商店时收到 502 Bad Gateway。

我正在使用 nginx 服务器,我就是这样做的。

server {
root /var/www/html/public/;
index index.php index.html;

listen       80  default_server;

error_log  /var/log/nginx/error-zzdefault.log;
access_log /var/log/nginx/access-zzdefault.log;

location / {
    proxy_pass http://magento/;
}

location /phpmyadmin/ {
    proxy_pass http://phpmyadmin/;
}

}


server {
listen       443 ssl;
server_name  mydomain.com.br;

keepalive_timeout   70;

ssl_certificate      /etc/nginx/ssl/mydomain-bundle.crt;
ssl_certificate_key  /etc/nginx/ssl/mydomain.key;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;

error_log  /var/log/nginx/error-zzdefault.log;
access_log /var/log/nginx/access-zzdefault.log;

root /var/www/html/public/;
index index.php index.html;


location / {
  proxy_pass https://magento/;

}
}

更改已通过 SSL 认证的第二个服务器位置上的 proxy_pass: Ip 32.999.999.999:80 应该是你的服务器主IP地址。通过 默认端口 80.

location / {
      proxy_pass http://32.999.999.999:80;
      proxy_set_header X-Real-IP  $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto https;
      proxy_set_header X-Forwarded-Port 443;
      proxy_set_header Host $host; }