【问题标题】:http nginx dockers behind https virtualhost apache proxy using letsencrypt redirect https to http使用letsencrypt将https重定向到http的https virtualhost apache代理后面的http nginx dockers
【发布时间】:2019-05-21 23:43:12
【问题描述】:

我在 Debian VPS 中安装了 Apache 服务器,我将其用作 Nginx 容器的代理反向包含静态网站,我将容器的端口 80 映射到 3002 并且它运行良好,但是当我访问 @ 时出现问题987654321@ 它将我重定向到http://www.example.com !我这样设置我的虚拟主机:

第一个 vHost (HTTP)

<VirtualHost *:80>
   ServerName example.com
   <Location />
     Order allow...
   </Location>
   ProxyRequests Off
   ProxyPreserveHost On
   #proxy to docker nginx -p 3002:80
   ProxyPass / http://localhost:3002
   ProxyPassReverse / http://localhost:3002

</VirtualHost>

第二个 vHost(由 Letencrypt Bot 创建的 HTTPS)

<VirtualHost *:443>
       ServerName example.com
       <Location />
         Order allow...
       </Location>
       ProxyRequests Off
       ProxyPreserveHost On
       #proxy to docker nginx -p 3002:80
       ProxyPass / http://localhost:3002
       ProxyPassReverse / http://localhost:3002
       #crt files..
       SSLCertificateFile /etc/letsen...
       SSLCertificateKeyFile /etc/letsen..
       Include /etc/letsencrypt/option...
</VirtualHost>

注意:docker镜像是kyma/docker-nginx

【问题讨论】:

    标签: apache docker nginx reverse-proxy lets-encrypt


    【解决方案1】:

    你需要一个 www 的别名:

    ServerName: example.com 
    ServerAlias: www.example.com
    

    【讨论】:

      猜你喜欢
      • 2019-03-13
      • 2016-09-06
      • 2018-03-08
      • 1970-01-01
      • 2011-03-29
      • 2018-01-05
      • 1970-01-01
      • 2014-05-08
      • 1970-01-01
      相关资源
      最近更新 更多