【问题标题】:Different site at HTTP vs HTTPSHTTP与HTTPS的不同站点
【发布时间】:2017-06-05 18:12:24
【问题描述】:

我正在接管一个多站点 Apache 服务器,其中包含两个网站(A 和 B)。通过 http 访问网站 A 的 url 可以正常工作。转到相同的 url,但使用 https,显示网站 B。这是为什么,以及如何使 https://urlA.com 转到网站 A?

【问题讨论】:

  • 发布服务器配置。这可能与服务器块的定义方式有关。

标签: apache http ssl https


【解决方案1】:

我解决了这个问题。

服务器设置了 VirtualHosts,但端口 443 没有 VirtualHost。所以它看起来像这样:

<VirtualHost 99.9.9.999:80>
DocumentRoot /var/www/example
ServerName example.com

    <Directory "/var/www/example">
            Options Indexes
            AllowOverride None
            DirectoryIndex index.php index.html
            Order allow,deny
            Allow from all
    </Directory>

添加一个在端口 443 上侦听的 VirtualHost,并指定 SSLCertFiles 解决了问题。

<VirtualHost 99.9.9.999:443>
DocumentRoot /var/www/example
ServerName example.com

    <Directory "/var/www/example">
            Options Indexes
            AllowOverride None
            DirectoryIndex index.php index.html
            Order allow,deny
            Allow from all
    </Directory>

SSLCertificateFile /etc/httpd/conf/example.crt
SSLCertificateKeyFile /etc/httpd/conf/_.example.key
SSLCertificateChainFile /etc/httpd/conf/gd_example.crt
SSLEngine on

</VirtualHost>

【讨论】:

    猜你喜欢
    • 2019-08-09
    • 1970-01-01
    • 2010-10-20
    • 2011-12-17
    • 2011-05-29
    • 2011-05-06
    • 1970-01-01
    • 2014-04-23
    • 2017-09-06
    相关资源
    最近更新 更多