How to setup certificate for "www" subdomain?

Hello, I have just setup a new SSL certificate with Certbot on my site musicianspage.com, but I have been unable to set it up for "www.musicianspage.com" because Certbot didn't give me the option of it even though it is defined as an alias in the Apache configuration of the site. How can I install the certificate for the "www.musicianspage.com" version of my site as well?

My domain is: musicianspage.com

I ran this command: certbot --apache

It produced this output: I had just two options: install the certificate for "musicianspage.com" or "server1.musicianspage.com" which is another subdomain we use. But not for "www.musicianspage.com" which is the official full domain of my site.

My web server is (include version): Apache/2.4.38 (Debian)

The operating system my web server runs on is (include version): Debian 10

I can login to a root shell on my machine (yes or no, or I don't know): YES with root access

I'm using a control panel to manage my site (no, or provide the name and version of the control panel): NO

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot): certbot 0.31.0

1 Like

Please show this part of the config:

AND also the output of:
apachectl -S

1 Like

Thank you rg305, I actually solved the problem myself. I just tackled the Apache config file for the site by changing this line:

ServerName musicianspage.com

to:

ServerName www.musicianspage.com

And then called Certbot again:

certbot --apache

And this time it showed me the www option.

Thank you anyway for your help :slight_smile:

That isn't the correct fix to this problem.
It only changes the problem from one name to the other.
You need to use both names.
Try:
ServerName musicianspage.com
ServerAlias www.musicianspage.com

2 Likes

After you've properly added the ServerAlias line as @rg305 indicated, Certbot will prompt you to include both names on your certificate!

2 Likes

Yes, I did that, I forgot to mention it.

Thank you very much! :slight_smile:

2 Likes

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