加载mod_ssl时,Apache2不会启动

我今天重新发布了我的网站的SSL证书,但是现在apache2不会再启动了。 我从service apache2 start得到的是这样的:

 [....] Starting web server: apache2[Sat Apr 12 13:52:51 2014] [warn] NameVirtualHost *:80 has no VirtualHosts Action 'start' failed. The Apache error log may have more information. failed! 

(这个警告不应该在apache2加载VirtualHost *:80个站点?)

这个日志之前只有正常的操作。 第2行是最初的重启动,第3行开始时不加载mod_ssl,第4行再次尝试用mod_ssl重启。

 chmod: changing permissions of `/home/servers/MTA/newserver/mods/deathmatch/resources/[maps]/maps/DM-OS-TheNicO-SML-II/meta.xml': Operation not permitted [Sat Apr 12 13:31:38 2014] [notice] caught SIGTERM, shutting down [Sat Apr 12 13:51:08 2014] [notice] Apache/2.2.22 (Debian) PHP/5.5.11-1~dotdeb.1 configured -- resuming normal operations [Sat Apr 12 13:51:51 2014] [notice] caught SIGTERM, shutting down 

使用LogLevel debug时,尝试启动apache时会出现以下几行:

 [Sat Apr 12 14:36:13 2014] [info] Init: Seeding PRNG with 656 bytes of entropy [Sat Apr 12 14:36:13 2014] [info] Init: Generating temporary RSA private keys (512/1024 bits) [Sat Apr 12 14:36:13 2014] [info] Init: Generating temporary DH parameters (512/1024 bits) [Sat Apr 12 14:36:13 2014] [info] Init: Initializing (virtual) servers for SSL 

我检查了SSLCertificateKeyFileSSLCertificateFile匹配,密钥是用于证书。 我正在用OpenSSL使用Debian Wheezy。

站点日志全部显示:

 [Sat Apr 12 17:04:22 2014] [info] Loading certificate & private key of SSL-aware server [Sat Apr 12 17:04:22 2014] [debug] ssl_engine_pphrase.c(470): unencrypted RSA private key - pass phrase not required [Sat Apr 12 17:04:22 2014] [info] Configuring server for SSL protocol [Sat Apr 12 17:04:22 2014] [debug] ssl_engine_init.c(469): Creating new SSL context (protocols: SSLv3, TLSv1, TLSv1.1, TLSv1.2) [Sat Apr 12 17:04:22 2014] [debug] ssl_engine_init.c(705): Configuring permitted SSL ciphers [HIGH:MEDIUM:!aNULL:!MD5] [Sat Apr 12 17:04:22 2014] [debug] ssl_engine_init.c(789): Configuring server certificate chain (4 CA certificates) [Sat Apr 12 17:04:22 2014] [debug] ssl_engine_init.c(420): Configuring TLS extension handling [Sat Apr 12 17:04:22 2014] [debug] ssl_engine_init.c(836): Configuring RSA server certificate [Sat Apr 12 17:04:22 2014] [debug] ssl_engine_init.c(875): Configuring RSA server private key 

Apache2肯定知道这些网站( apache2ctl -t -D DUMP_VHOSTS ):

 [Sat Apr 12 17:21:02 2014] [warn] NameVirtualHost *:80 has no VirtualHosts VirtualHost configuration: wildcard NameVirtualHosts and _default_ servers: *:80 is a NameVirtualHost default server twisted.twisted-gamers.net (/etc/apache2/sites-enabled/000-default:1) port 80 namevhost twisted.twisted-gamers.net (/etc/apache2/sites-enabled/000-default:1) port 80 namevhost dev.twisted-gamers.net (/etc/apache2/sites-enabled/dev.twisted-gamers.net:1) port 80 namevhost editor.twisted-gamers.net (/etc/apache2/sites-enabled/editor.twisted-gamers.net:1) port 80 namevhost forum.twisted-gamers.net (/etc/apache2/sites-enabled/forum.twisted-gamers.net:1) port 80 namevhost i.3ventic.eu (/etc/apache2/sites-enabled/i.3ventic.eu:1) port 80 namevhost minecraft.twisted-gamers.net (/etc/apache2/sites-enabled/minecraft.twisted-gamers.net:1) port 80 namevhost nyans.twisted-gamers.net (/etc/apache2/sites-enabled/nyans.twisted-gamers.net:1) port 80 namevhost www.twisted-gamers.net (/etc/apache2/sites-enabled/twisted-gamers.net:1) port 80 namevhost www.wiki.twisted-gamers.net (/etc/apache2/sites-enabled/wiki.twisted-gamers.net:1) *:443 is a NameVirtualHost default server dev.twisted-gamers.net (/etc/apache2/sites-enabled/dev.twisted-gamers.net:22) port 443 namevhost dev.twisted-gamers.net (/etc/apache2/sites-enabled/dev.twisted-gamers.net:22) port 443 namevhost editor.twisted-gamers.net (/etc/apache2/sites-enabled/editor.twisted-gamers.net:21) port 443 namevhost forum.twisted-gamers.net (/etc/apache2/sites-enabled/forum.twisted-gamers.net:21) port 443 namevhost i.3ventic.eu (/etc/apache2/sites-enabled/i.3ventic.eu:16) port 443 namevhost www.twisted-gamers.net (/etc/apache2/sites-enabled/twisted-gamers.net:21) Syntax OK 

我怎样才能让Apache2再次运行SSL?

如果你configuration了一个VirtualHost,并且Apache给你一个警告,说明没有configurationVirtualHosts,那么问题出在你的VirtualHostsconfiguration上,而不是你的SSL证书。

我会检查你的VirtualHostsconfiguration语法错误,可能已经发生,而你正在更新它,以考虑到你的新证书。

Apache2正在悄然崩溃,因为在更新新私钥的path时,我错过了其中一个虚拟主机。 这导致了一个不匹配的错误,显然默默地崩溃了Apache。

你是否同时升级你的Apache? 对于Apache HTTPD的最新版本,您的站点configuration文件必须以.conf结尾(即/etc/apache2/sites-available/my-site.conf ),否则在启动时它们将被HTTPD忽略。

否则请尝试apache2ctl -t -D DUMP_VHOSTS ,它应该告诉你你的Apache知道什么虚拟主机。