我運行一個託管多個站點的Ubuntu(17.04)服務器。我現在託管的其中一個網站是電子商務網站,需要SSL證書。我經歷了許多不同的教程,並且我已經遵循了每一步,但是當我使用HTTPS訪問網站時,我只是收到一個錯誤頁面。SSL不能在多虛擬主機的ubuntu服務器上工作
下面截圖中的域名是假的。
首先我從Comodo購買了SSL證書。他們要求CSR從服務器,所以我生成它使用這個命令:
openssl req -new -newkey rsa:2048 -nodes -keyout domain.key -out domain.csr
我粘貼的CSR和生成的沒有問題的CRT。現在我已經從Comodo的CRT和更新我的虛擬主機的安全連接:
<VirtualHost *:443>
ServerAdmin [email protected]
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或一些步驟。