【发布时间】:2017-03-10 15:21:39
【问题描述】:
下午好,
我有一个 Magento 安装,Nginx 在 AWS 上的 Auto Scaling 组上运行,标准 3 个实例。为了重定向流量,我使用了带有 SSL 的负载均衡器,导致我的结构如下所示:
用户>负载均衡器(443端口)>实例(80端口)
我将使用 https 的 URL 更改为我的数据库 mg_core_config_data 表中的 URL。
我认为正在发生的问题如下:
每次我访问我的 URL 时,负载均衡器都会尝试获取正文内容以向我发送我请求的信息,这样,当我使用端口 80 时,负载均衡器会到达我的实例并尝试加载Magento,数据库中的 base_url 重定向到 https。通过此重定向,该过程再次重复,因为我被重定向回 https:// 并尝试再次获取端口 80 上的实例信息。我认为每个问题都在这个 base_url 中,我无法返回端口 80 的 magento 信息。
按照我的 nginx 配置:
server {
listen 80 DEFAULT_SERVER;
server_name _;
root /home/ubuntu/www/mysite;
index index.php index.html index.htm;
location / {
try_files $ uri $ uri / /index.php$is_args$args;
}
location ~ \ .php $ {
try_files $ uri /index.php = 404;
fastcgi_pass unix: /run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;
fastcgi_params include;
fastcgi_cache CACHE;
fastcgi_cache_methods GET HEAD;
fastcgi_cache_valid 200 1m;
fastcgi_cache_bypass $ no_cache;
fastcgi_no_cache $ no_cache;
}
...
}
我通过 https 访问负载均衡器时遇到的错误:
有人有什么建议或经历过吗?
谢谢。
【问题讨论】:
标签: magento amazon-web-services nginx load-balancing