Cerbot unable to find ServerNames on Apache Due to Multiple VHOSTS in Config File

Hi there,

I’d like to use Let’s Encrypt and therefore certbot on my Debian Jessie, Apache 2.4-Setup.

But when i run certbot --apache it show’s me this error message:

No names were found in your configuration files. You should specify ServerNames in your config files in order to allow for accurate installation of your certificate. If you do use the default vhost, you may specify the name manually. Would you like to continue?

My config files are in /etc/apache2/sites-available with a .conf extension and symlinked to /etc/apache2/sites-enabled. All my config files look like this: http://pastebin.com/tENAizw2 (pastebin due to forum software is not formatting the config correctly).

/etc/apache2/snippets/ssl-domain.de.conf

SSLEngine on SSLCertificateFile /etc/apache2/ssl/domain.de/2__.dominicpratt.de.crt SSLCertificateKeyFile /etc/apache2/ssl/domain.de/wildcard.key SSLCertificateChainFile /etc/apache2/ssl/domain.de/1_root_bundle.crt

and the /etc/apache2/snippets/cache.conf is just a cache configuration with “ExpiresByType”-commands in it.

Any help on this would be appreciated!

Regards,
Dominic

certbot currently assumes that each configuration file only includes one <VirtualHost> tag. It looks like you have both the HTTP and HTTPS vhost in the same file, which would confuse the client.

I would also recommend removing your current SSL vhosts completely. The idea behind the apache installer is that certbot will look at your HTTP vhosts and create corresponding HTTPS vhosts automatically, with all the SSL directives set correctly. HTTP to HTTPS redirection is offered as an option too. Existing SSL vhosts tend to complicate that a bit and the results are often less than optimal (though you could, of course, try it :smile:) . Another alternative would be using certonly, for example with the webroot plugin, which does not actively modify your configuration, meaning you could preserve/adapt your current configuration.

2 Likes

Yeah, thanks! When I removed the ssl-config-block it works flawless!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.