【问题标题】:Magento + Turpentine + SSL only generates HTTP URLsMagento + Turpentine + SSL 仅生成 HTTP URL
【发布时间】:2015-10-04 09:20:36
【问题描述】:

我正在努力解决这个问题,所以我非常感谢一些帮助:/

我将松节油与 Magento 1.7 CE 和 Varnish 3 一起使用,效果很好。现在我想添加 SSL 加密,但效果不太好。

SSL 加密由 Pound 终止(监听 443),然后数据被提供给 Varnish(监听 6081),最后被提供给 nginx(8080)。问题是所有生成的 URL(产品链接、类别等)都是使用 HTTP 生成的,而不是 HTTPS。

我尝试将不安全的基本 URL 设置为 https,但这完全破坏了我的网站(我有一个 404“嵌入循环”,它从未停止加载)。

SSL 卸载似乎可以工作,因为所有资源都使用 HTTPS 加载(如果我弄乱了 Magento 中的 SSL 卸载设置,我会收到有关混合内容的警告)。

phpinfo 告诉我有关 HTTPS 的信息:

[...]
_SERVER["HTTPS"] on
_SERVER["HTTP_SSL_OFFLOADED"] 1
[...]

我的配置:

Magento(我认为最重要的部分):

Auto-redirect to Base URL: No
Use Web Server Rewrites: Yes
Unsecure Base URL: http://myurl.com
Secure Base URL: https://myurl.com
Use Secure URLs in Frontend: Yes
Offloader Header: HTTP_SSL_OFFLOADED

英镑:

ListenHTTPS
    Address 0.0.0.0
    Port    443
    Cert    "/path/to/my/cert.pem"
    xHTTP   2
    RewriteLocation 1
    Ciphers "RC4:!SSLv2:!ADH:!aNULL:!eNULL:!NULL:!LOW:!EXP"
    AddHeader "Ssl-Offloaded: 1"
End

Service
    BackEnd
        Address 127.0.0.1
        Port    6081
    End
End

Varnish 使用 Turpentine-Config(无需 SSL 也能正常工作)

nginx:

server {
        listen 8080 default_server;

        root /var/www/mysite.at;

        index index.php;

        server_name _;

        location / {
                try_files $uri $uri/ /index.php;
        }
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
                root /usr/share/nginx/www;
        }


        location ~ \.php$ {
                fastcgi_split_path_info ^(.+\.php)(/.+)$;

                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;

                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
               fastcgi_param HTTPS on;
        }

        location ~ /\.ht {
                deny all;
        }
}

我真的没有想法 :( 如果需要,我很乐意提供有关我的配置的更多详细信息。

【问题讨论】:

    标签: magento ssl nginx varnish pound


    【解决方案1】:

    原来我有多个问题。

    1. “位置/”的 nginx 配置:

      location / {
              try_files $uri $uri/ @handler;
      }
      
      location @handler {
              rewrite / /index.php;
      }
      

    没有 ajax 调用将无法工作。

    1. Magento 配置中不安全的基本 url 需要包含“https”

    2. Turpentine 必须对 ESI 使用 HTTP URL,而不是 HTTPS。此提交中显示了必要的更改:

    https://github.com/eth8505/magento-turpentine/commit/575f499382217f0013eaf097fd79ceddec0b4381

    【讨论】:

      猜你喜欢
      • 2013-03-17
      • 1970-01-01
      • 2016-07-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多