Custom ServerAlias missing from Let's Encrypt Certificate Entries

Kal

Verified User
Joined
Nov 18, 2019
Messages
129
Location
Australia
I created a subdomain (sub1.domain.com) in DirectAdmin. I then added the following custom HTTPD config:
Code:
|*if SUB="sub1"|
|?SDOCROOT=/var/www/html/`SUB`|
|?SERVER_ALIASES=`SERVER_ALIASES` sub2.`DOMAIN`|
|*endif|


So this accomplishes two things:
  1. Points the subdomain to the web app at /var/www/html/sub1
  2. Creates an additional alias (sub2.domain.com), which points to the same place.
(Of course I made sure both sub1 and sub2 have A records in the DNS.)

I like this solution, but there's a problem… sub2.domain.com doesn't show up in the list of Let's Encrypt Certificate Entries, so I can't automate SSL/TLS certificates for it. I don't want this subdomain to show up in the list for other users, so I can't add it to the letsencrypt_list.

What's the simplest way to fix this? Or am I going about it the wrong way?
 
I'd suggest a wildcard there :)

Thanks Martynas, that's thinking outside the box, and indeed simple! I don't normally use wildcards so I had overlooked that.

So, I just generated a new wildcard certificate, and both subdomains are now working. But for some reason, I still get an SSL error (connection is not private, etc) if I add the www (www.sub1.domain.com)—a name mismatch it seems. Do wildcard certificates not work beyond the first subdomain level? It's no biggie I suppose, as I prefer to redirect to the non-www version anyway—I'm just trying to understand why it's failing.
 
There's another problem with my custom HTTPD config, but it's unrelated to my original question so I've started a new thread:
 
How to install SSL certificate on a domain alias


I have a main domain ABC.com
I have created a domain pointer DEF.com and point it to ABC.com as an alias.
Now I want to install SSL on alias DEF.com
but when I go to SSL certificates >> Paste a pre-generated certificate and key. There is no option to select my alias domain DEF.com have certificate files but where I can place them for DEF.com.
Kindly guide me on this.


When I use this command it set the SSL on DEF.com of my domain ABC.com.

cd /usr/local/directadmin/scripts
./letsencrypt.sh request DEF.com 4096
 
Back
Top