Can't add optional domain name


#1

I couldn’t create certificates at first with multiple domains and subdomains, but then successfully made one for example.no. Trying to add more to the list prompts the following error:

Domains: en.example.com, en.example.no, example.com,
example.no, www.example.com, www.example.no
Error: The server could not connect to the client for DV

For some reason, the client claims not to find the ServerName, and that might be true. I should admit I am new to anything sysadmin or superuser so this is pretty much foreign territory to me (but I’m learning, yay!). The server is supposed to take both .no and .com, but I might just redirect .com to .no/en/ or something.

Any tips?

Also, I checked the option to redirect to https://, but regret it. Now everything, including those pages not covered by the cert is redirected, which I think is rather impractical. Does anyone know how to reverse this? I removed a rewrite rule from the sites-available conf file, but that didn’t help.


#2

It seems like letsencrypt can’t connect to one of the domains. Are all of the domains you’re trying to use configured correctly in your DNS server? And if they’re on different IPs, is your webserver listening on all of them?


#3

I checked my DNS and you’re right - I added a new A record for *.example.no and *.example.com.
I tried adding a certificate for example.no and www.example.no, but now I got this error:

Error: The client lacks sufficient authorization


#4

Did you also configured your webserver to serve files for that domain?


#5

I utterly confused myself earlier by trying the following;
I entered the virtualhost config file 000-default.conf in apache’s folders, and added one ServerName and several ServerAlias-es to match those I wished to use. I thought that’s what was required. But afterwards, there was no change when I made another attempt at creating a certificate. I realized I should probably restart apache after making changes to the config files, so I entered the command.

Apache reported some errors and refused to start up again. So I went back and removed the ServerName and ServerAlias variables, and it started again.

I don’t know what I’m doing, sorry for troubling you. :sweat_smile:


#6

I’m sorry I’m no big help with configuring the Apache HTTP server, our servers all run nginx, but you may consult the documentation for ServerName and ServerAlias: https://httpd.apache.org/docs/current/mod/core.html#serveralias

Also if you post your config (or at least the part that failed), somebody with Apache experience may be able to help you. :wink:


#7

Not familiar with that particular Apache HTTPd configuration, but ServerName and ServerAlias only work inside a VirtualHost block.

For any names that are not explicitly defined, you’ll get the default site on the server. This is usually the first VirtualHost block that’s loaded or the global DocumentRoot if you don’t have any. You can run “apachectl -t -D DUMP_VHOSTS” to see how the configurations are loaded and where they are defined. For Debian and Debian-based systems, you’ll use apache2ctl in place of apachectl.