Apache:为每个虚拟主机设置单独的 SSL 证书

Apache:为每个虚拟主机设置单独的 SSL 证书

我已经生成了让加密(阶段模式)证书并将其安装在我的网络服务器中,我在检查每个证书的指纹时遇到问题,我发现它与浏览器显示的不同,更糟糕的是,浏览器只显示所有域的一个证书。对于这两个域,我看到的是:在此输入图像描述 钥匙尺寸正确,但指纹不同,为什么?

我的httpd.conf

ServerRoot "/etc/httpd"

Listen 80

Listen 443 https
SSLStrictSNIVHostCheck on

Include conf.modules.d/*.conf

User apache
Group apache

ServerAdmin root@localhost

ServerName 15.188.158.148:80
#ServerName highschoolhelper.org

<Directory />
    AllowOverride none
    Require all denied
</Directory>

DocumentRoot "/var/www/html"

<Directory "/var/www">
    AllowOverride None
    Require all granted
</Directory>


<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>

<Files ".ht*">
    Require all denied
</Files>

ErrorLog "logs/error_log"
LogLevel warn

<IfModule log_config_module>
    LogFormat "%h %v %V %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>

    CustomLog "logs/access_log" combined
</IfModule>

<IfModule alias_module>
    ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
</IfModule>

<Directory "/var/www/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>

<IfModule mime_module>
    TypesConfig /etc/mime.types

    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
</IfModule>

AddDefaultCharset UTF-8

<IfModule mime_magic_module>
    MIMEMagicFile conf/magic
</IfModule>


EnableSendfile on

IncludeOptional conf.d/*.conf
IncludeOptional conf.d/domains/*.conf

每个虚拟主机配置都有一个与此类似的配置:

<VirtualHost *:80>
    ServerName apple.highschoolhelper.org
    ServerAlias apple.highschoolhelper.org www.apple.highschoolhelper.org
    DocumentRoot /var/www/html/apple.highschoolhelper.org/public_html
    ServerAdmin [email protected]
    DirectoryIndex index.html index.php
    LogLevel warn
    <Directory /var/www/html/apple.highschoolhelper.org/public_html>
        IndexIgnoreReset ON
        IndexIgnore .well-known

        Options +Indexes +FollowSymLinks
        AllowOverride All
    </Directory>
    ErrorLog /var/log/httpd/apple.highschoolhelper.org-error.log
    CustomLog /var/log/httpd/apple.highschoolhelper.org-access.log combined
</VirtualHost>
<VirtualHost *:443>
    ServerName apple.highschoolhelper.org
    ServerAlias apple.highschoolhelper.org www.apple.highschoolhelper.org
    DocumentRoot /var/www/html/apple.highschoolhelper.org/public_html
    ServerAdmin [email protected]
    DirectoryIndex index.html index.php
    LogLevel warn
    <Directory /var/www/html/apple.highschoolhelper.org/public_html>
        IndexIgnoreReset ON
        IndexIgnore .well-known

        Options +Indexes +FollowSymLinks
        AllowOverride All
    </Directory>
    ErrorLog /var/log/httpd/apple.highschoolhelper.org-error.log
    CustomLog /var/log/httpd/apple.highschoolhelper.org-access.log combined


    SSLEngine       on
    SSLCertificateFile      /etc/letsencrypt/live/apple.highschoolhelper.org/apple.highschoolhelper.org_fullchain.crt
    SSLCertificateKeyFile       /etc/letsencrypt/live/apple.highschoolhelper.org/apple.highschoolhelper.org_pkey.pem
</VirtualHost>

主域证书:

-----BEGIN CERTIFICATE-----
MIIGPzCCBSegAwIBAgITAPrxRtrC7JMtDhGS3WITo5TdmTANBgkqhkiG9w0BAQsF
ADAiMSAwHgYDVQQDDBdGYWtlIExFIEludGVybWVkaWF0ZSBYMTAeFw0yMDA1MTky
MDA1MDZaFw0yMDA4MTcyMDA1MDZaMB8xHTAbBgNVBAMTFGhpZ2hzY2hvb2xoZWxw
ZXIub3JnMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAmMg9z4hIP1do
sL3qQ1pqpl9JpNpqYE4NeI0/8HEDvC7Io08S3y9HzR+WxDzXWJl+Xv7z2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END CERTIFICATE-----

答案1

我现在看到的证书https://highschoolhelper.org是由“cPanel, Inc. Certification Authority”颁发的。这表明您的托管提供商正在使用 cPanel 系统,该系统会覆盖您在 Apache 配置文件中所做的任何配置的某些部分,或者可能是一个以集中方式管理所有客户的 SSL/TLS 支持的设置。

您可能必须使用某种托管控制面板来配置主域的证书,而不是直接修改网络服务器配置。

托管提供商还可能有某种自动化功能,以固定的时间间隔运行并更新某些内容,因此某些更改可能不会在您做出更改后立即在互联网上可见,但只有在自动化完成其工作后才可见。

如果您不确定,请参阅您的托管提供商的文档或联系他们以获取进一步的说明。只有他们才能确切地知道他们的系统是如何设置的。

我当前看到的证书与https://apple.highschoolhelper.org您为其发布的证书匹配,并且指纹也匹配。

根据您的配置,应该在与您之前提到的不匹配的https://apple.highschoolhelper.org文件中找到 的证书- 我猜您做了一些更改?/etc/letsencrypt/live/apple.highschoolhelper.org/apple.highschoolhelper.org_fullchain.crt*.csr

您可以使用以下命令检查服务器上证书文件的指纹:

openssl x509 -in /etc/letsencrypt/live/apple.highschoolhelper.org/apple.highschoolhelper.org_fullchain.crt -noout -fingerprint -sha256

如果与浏览器显示的 SHA-256 指纹匹配,则该证书工作正常。

您发布的主域证书是自签名证书,其主题和颁发者字段均为C=AU, ST=Aust, L=City, O=Default Company Ltd, CN=aws-host.这看起来像是由托管提供商自动化生成的默认证书,该证书只能在虚拟主机和为主域提供 SSL/TLS 的提供商集中式系统之间使用。

相关内容