【发布时间】: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 或其他东西的步骤。
【问题讨论】: