1

I reissued the SSL certificates for my website today, but now apache2 will not start up anymore. All I get from service apache2 start is this:

[....] 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!

(The warning shouldn't be there as apache2 is loading VirtualHost *:80 sites?)

There are only normal operations before this log. Line 2 is the original restart, line 3 is starting without loading mod_ssl and line 4 is trying to restart with mod_ssl again.

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

With LogLevel debug I get the following lines when trying to start 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

I checked that the SSLCertificateKeyFile and SSLCertificateFile match and the key is for the certificate. I'm using Debian Wheezy with OpenSSL.

Site-logs all show this:

[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 definitely knows about the sites (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

How can I get apache2 running with SSL again?

2
  • Does the server start with your existing certs? If so, its a problem with the certs. If it doesn't, its a problem with your VirtualHosts config. Apr 12, 2014 at 12:35
  • apache2ctl -S says everything's OK, except for that NameVirtualHost *:80 warning, and it fails with the old certificates as well.
    – 3ventic
    Apr 12, 2014 at 12:38

4 Answers 4

2

If you have configured a VirtualHost, and Apache is giving you a warning that there are no VirtualHosts configured, the problem is with your VirtualHosts config, not your SSL certs.

I'd check you VirtualHosts config for syntax errors that may have occurred while you were updating it to take account of your new certificate.

5
  • If apache2ctl -S says Syntax OK, shouldn't it be OK to go then?
    – 3ventic
    Apr 12, 2014 at 12:42
  • If apache isn't starting, there is something wrong with the config. Try running the apache binary, httpd, and see what that says. Apr 12, 2014 at 12:52
  • Also, make sure that there is nothing else running on port 80 or 443, if they are the ports you are using. Apr 12, 2014 at 12:54
  • Running the binary says apache2: bad user name ${APACHE_RUN_USER} 80 and 443 are free.
    – 3ventic
    Apr 12, 2014 at 13:06
  • OK, apachectl obviously sets the APACHE_RUN_USER env var before httpd is run. You could temporarily edit the apache2.conf file and change User and Group to www-data and try and run httpd again. This is based on the assumption that this is Ubuntu. Otherwise, the user may be something else. Apr 12, 2014 at 17:25
1

Apache2 was silently crashing because I had missed one of the virtualhosts when updating the paths to the new private keys. This caused a mismatch error that apparently silently crashed apache.

0
0

Did you upgrade your Apache at the same time? For recent versions of Apache HTTPD, your site config files must end in .conf (ie /etc/apache2/sites-available/my-site.conf) or they will be ignored by HTTPD as it's starting up.

Otherwise try apache2ctl -t -D DUMP_VHOSTS which should tell you what virtual hosts your Apache knows about.

3
  • Added the results of vhost dump to the question.
    – 3ventic
    Apr 12, 2014 at 15:23
  • in that case does this answer I wrote to another question help? It might be waiting for a passphrase for your SSL key. Although I would think that would give a different error... Apr 12, 2014 at 15:27
  • Now I see that your logs are reporting no passphrase, so it can't be that. I reckon there must be another log file somewhere that contains an actual error -- are you looking in /var/log/apache2/ as well as the folders you've set up in your virtualhost config? Apr 12, 2014 at 15:50
0

I experienced this issue. I turned out that the ssl.conf file had uncommented locations of certificate (its there by default) i added my own configurations without commenting the default. Try looking to the older certificate locations and modify them.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .