0

设置:

Nginx 作为反向代理,终止 https

localhost:8080 的 Apache 将 Mailman 应用程序(管理员 gui)交付给 Nginx

当我在浏览器中输入确切的 URL(例如 https://lists.staging.xxx.de/mailman/ )时,它可以完美运行。

当我输入https://lists.staging.xxx.de/mailman(不带斜杠)甚至只输入https://lists.staging.xxx.de/时,Apache RedirectMatch 就会启动,并通过标头位置信息 -但方案不正确,即“位置: http: //lists.staging.xxx.de/mailman/

当我这样做时,curl -L -v -s -o /dev/null localhost:8080我会回来:Location: http://localhost:8080/mailman/.

所以我得出结论:Nginx 正确地重写了主机,但不是方案。

所以,要么我必须更改 Nginx 的配置,所以它重写头文件(即方案),或者我必须让 Apache 意识到——即使 https 被终止——头文件位置语句也应该包含一个 https。

任何帮助表示赞赏!

Nginx 配置:

server {
listen xxx:443;

server_name lists.staging.xxx.de;

if ($host != lists.staging.xxx.de) {
       rewrite (.*) https://lists.staging.xxx.de$1 permanent;
} 

ssl on;
ssl_certificate  /srv/s-bliss/deployment/work/nginxmailman/lists.staging.xxx.de.crt;
ssl_certificate_key  /srv/s-bliss/deployment/work/nginxmailman/lists.staging.xxx.de.key;

location / {
    proxy_pass              http://127.0.0.1:8080;
    proxy_set_header        Host $http_host;
    proxy_set_header        X-Real-IP $remote_addr;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_redirect          off;
}

}

阿帕奇配置:

Listen 127.0.0.1:8080
<VirtualHost 127.0.0.1:8080>
    ServerName lists.staging.xxx.de

    Alias /mailman/icons /usr/lib/mailman/icons
    <Directory "/usr/lib/mailman/icons/">
            AllowOverride None
            Require all granted
    </Directory>

    Alias /mailman/archives /var/lib/mailman/archives/public
    <Directory "/var/lib/mailman/archives/public/">
            AllowOverride None
            Options ExecCGI FollowSymLinks
            AddDefaultCharset off
            Require all granted
    </Directory>

    RedirectMatch ^/$ /mailman/
    RedirectMatch ^/mailman$ /mailman/
    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^/mailman/(archives|icons)
    RewriteRule ^/mailman/(.*) /usr/lib/mailman/cgi-bin/$1 [H=cgi-script]
    <Directory "/usr/lib/mailman/cgi-bin/">
            AllowOverride None
            Options ExecCGI
            DirectoryIndex listinfo
            Require all granted
    </Directory>

4

1 回答 1

0

我们的提供商提出了以下解决方案:

http://lists.staging.xxx.de/mailman/ https://lists.staging.xxx.de/mailman/;

有用!

更新:标头现在已正确传递,但有效负载(正文)仍包含指向 http 版本的链接。

于 2017-03-29T13:41:46.623 回答