【问题标题】:Site redirects with https but works with http on Apache2站点使用 https 重定向,但在 Apache2 上使用 http
【发布时间】:2017-12-14 21:31:54
【问题描述】:

我有一个管理面板,它表现得很时髦

当站点以 http:// 开头时,它似乎可以正常工作,但是当我使用 SSL 证书时,它会使用 https:// 而不是管理员重定向到主站点面板子域。同样奇怪的是,我的 api 也是不安全的。

我想这与 SSL 证书的安装方式有关,但我对 apache2 的了解有限。

这是启用站点的管理面板文件:

ServerAdmin webmaster@localhost
ServerName (admin panel url)
ServerAlias (admin panel url)
DocumentRoot (location of admin panel files)

SSLEngine on
SSLCertificateFile (location of ssl crt file)
SSLCertificateKeyFile (location of ssl key file)
SSLCertificateChainFile (location of ssl bundle crt file)

【问题讨论】:

    标签: linux ubuntu ssl apache2


    【解决方案1】:

    我发现管理面板的 https:// vs http:// 问题。 原来我的虚拟主机没有在 /sites-enabled/ 的管理面板文件中正确设置

    我为我的管理面板重命名了虚拟主机的端口,并创建了一个新的虚拟主机,以便在用户不访问安全站点并强制他们进入该站点时进行捕获。

    现在看起来像:

    <VirtualHost *:80>
        ServerName (admin panel url)
        ServerAlias (admin panel url)
        Redirect permanent / https://(admin panel url)
    </VirtualHost>
    
    <VirtualHost *:443>
        ServerAdmin webmaster@localhost
        ServerName (admin panel url)
        ServerAlias (admin panel url)
        DocumentRoot (directory of admin panel files)
    
        SSLEngine on
        SSLCertificateFile (location of crt file)
        SSLCertificateKeyFile (location of key file)
        SSLCertificateChainFile (location of bundle crt file)
    </VirtualHost>
    

    【讨论】:

      猜你喜欢
      • 2017-12-28
      • 2016-12-09
      • 1970-01-01
      • 2014-08-18
      • 2020-04-16
      • 1970-01-01
      • 2020-03-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多