【问题标题】:SSL not working on ubuntu server with multiple vhostsSSL 无法在具有多个虚拟主机的 ubuntu 服务器上运行
【发布时间】:2018-01-26 05:24:33
【问题描述】:

我运行一个托管多个站点的 Ubuntu (17.04) 服务器。我现在托管的网站之一是电子商务网站,需要 SSL 证书。我已经阅读了许多不同的教程,并且遵循了每一步,但是当我使用 HTTPS 访问该站点时,我只是得到了一个错误页面。

以下截图中的域名是假的。

首先我从 Comodo 购买了 SSL 证书。他们从服务器请求 CSR,所以我使用以下命令生成它:

openssl req -new -newkey rsa:2048 -nodes -keyout domain.key -out domain.csr

我粘贴了 CSR 并毫无问题地生成了 CRT。现在我有 Comodo 的 CRT 并更新了我的虚拟主机以实现安全连接:

<VirtualHost *:443>

ServerAdmin test@test.com
ServerName www.domain.com
ServerAlias domain.com
DirectoryIndex index.php
DocumentRoot /var/www/html/domain
SSLEngine on
SSLCertificateFile /etc/ssl/certs/www_domain_com.crt
SSLCertificateKeyFile /etc/ssl/private/domain_com.key

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

然后我跑了:

a2enmod ssl

最后重启了apache。现在,当我访问该站点时,我只看到此错误页面:

查看 apache 错误日志,唯一的提示可能是以下消息:

[Thu Aug 17 16:42:42.746221 2017] [mpm_prefork:notice] [pid 19871] AH00169: caught SIGTERM, shutting down
[Thu Aug 17 16:42:42.836087 2017] [ssl:warn] [pid 22306] AH01909: 2001:4802:7801:103:be76:4eff:fe20:7c04:443:0 server certificate does NOT include an ID which matches the server name
[Thu Aug 17 16:42:42.874200 2017] [ssl:warn] [pid 22316] AH01909: 2001:4802:7801:103:be76:4eff:fe20:7c04:443:0 server certificate does NOT include an ID which matches the server name
[Thu Aug 17 16:42:42.878354 2017] [mpm_prefork:notice] [pid 22316] AH00163: Apache/2.4.25 (Ubuntu) OpenSSL/1.0.2g configured -- resuming normal operations
[Thu Aug 17 16:42:42.878374 2017] [core:notice] [pid 22316] AH00094: Command line: '/usr/sbin/apache2'

任何帮助将不胜感激。这是该服务器第一次拥有 SSL 网站,所以也许我错过了使用 openSSL 或其他东西的步骤。

【问题讨论】:

    标签: apache ubuntu ssl


    【解决方案1】:

    您的第一个错误是从 Namecheap 购买证书。我最近在让他们的 crt 工作时遇到了类似的问题。直到我决定使用 Let's Encrypt 并使用他们的 certbot 生成 SSL 证书,我才能够解决问题。我无法证明这一点,但我怀疑 Namecheap 构建签名证书的捆绑工具存在问题。

    Let's Encrypt 是一个完全免费的开源项目,可解决您的 HTTPS 需求。我也有多个虚拟主机,并在几分钟内启动并运行 Let's Encrypt。

    https://letsencrypt.org/

    【讨论】:

      猜你喜欢
      • 2011-02-01
      • 2018-09-08
      • 1970-01-01
      • 1970-01-01
      • 2012-01-22
      • 2016-06-11
      • 1970-01-01
      • 2020-01-17
      • 2015-05-07
      相关资源
      最近更新 更多