尝试安装 SSL 后 Apache 无法启动

尝试安装 SSL 后 Apache 无法启动

下面是我的 VirtualHosts 在 httpd.conf 中的样子

<VirtualHost *:80>
  # Admin email, Server Name (domain name) and any aliases
  ServerAdmin [email protected]
  ServerName  mydomain.com
  ServerAlias www.mydomain.com

  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.php
  DocumentRoot /home/mydomain/public_html/mydomain.com/public

  # Custom log file locations
  LogLevel warn
  ErrorLog  /home/mydomain/public_html/mydomain.com/log/error.log
  CustomLog /home/mydomain/public_html/mydomain.com/log/access.log combined
</VirtualHost>

<VirtualHost *:443>
  SSLEngine on
  SSLCertificateFile /etc/httpd/conf/ssl.crt/mydomain.com.crt
  SSLCertificateKeyFile /etc/httpd/conf/ssl.key/mydomain.com.key

  ServerName  mydomain.com
  DirectoryIndex index.php
  DocumentRoot /home/mydomain/public_html/mydomain.com/public

</VirtualHost>

我在 CentOS 上使用最新版本的 Apache,没有生成任何错误。Apache 就是无法启动。有什么想法我做错了吗?

更新-在错误日志中发现这些消息:

[Tue Mar 16 02:07:57 2010] [error] Init: Private key not found
[Tue Mar 16 02:07:57 2010] [error] SSL Library Error: 218710120 error:0D094068:asn1 encoding routines:d2i_ASN1_SET:bad tag
[Tue Mar 16 02:07:57 2010] [error] SSL Library Error: 218529960 error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag
[Tue Mar 16 02:07:57 2010] [error] SSL Library Error: 218595386 error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error
[Tue Mar 16 02:07:57 2010] [error] SSL Library Error: 218734605 error:0D09A00D:asn1 encoding routines:d2i_PrivateKey:ASN1 lib

答案1

找不到/etc/httpd/conf/ssl.key/mydomain.com.key文件。

在日志中您有:

[Tue Mar 16 02:07:57 2010] [error] Init: Private key not found

相关配置为:

SSLCertificateKeyFile /etc/httpd/conf/ssl.key/mydomain.com.key

答案2

您需要安装 mod_ssl 包

答案3

SSLCertificateFile和存在吗SSLCertificateKeyFile?如果存在,则看起来它们是畸形的。

相关内容