Can't find domain name certbot LE certificate install

Hello, I’m trying to install LE on a LAMP server (Ubuntu 16.4) [digital ocean] using certbot, however when I enter sudo certbot --apache in order to certificate my domain, my domain name is not on the list. Only an old subdomain is actually on the list.

This is what I get entering sudo certbot --apache

   root@lamp-1gb-nyc3-01:~# sudo certbot --apache
    Saving debug log to /var/log/letsencrypt/letsencrypt.log
    Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org

    Which names would you like to activate HTTPS for?
    -------------------------------------------------------------------------------
    1: m.mywebsite.com
    -------------------------------------------------------------------------------
    Select the appropriate numbers separated by commas and/or spaces, or leave input
    blank to select all options shown (Enter 'c' to cancel):

Thank you

You will need to create a new certificate, but how to do so depends entirely on your environment. There’s no such thing as ‘transferring’ certificates in this manner, as they are immutable objects.

If you provide answers to the question prompts from when you made this thread, we could provide more assistance on how to receive a new certificate for this primary domain.

1 Like

thanks for you answer,

What do you mean by environment? is LAMP server (Ubuntu 16.4) not enough?

If the Apache configuration has a ServerName or ServerAlias setting for the domain, if you run the same Certbot command again, it should list it as one of the available choices, and offer to create a certificate for it.

3 Likes

This is what I get entering sudo certbot --apache

   root@lamp-1gb-nyc3-01:~# sudo certbot --apache
    Saving debug log to /var/log/letsencrypt/letsencrypt.log
    Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org

    Which names would you like to activate HTTPS for?
    -------------------------------------------------------------------------------
    1: m.mywebiste.com
    -------------------------------------------------------------------------------
    Select the appropriate numbers separated by commas and/or spaces, or leave input
    blank to select all options shown (Enter 'c' to cancel):

To expand slightly on what @mnordhoff said…

Certbot has no way to know what domain names are pointed at your server, so it tries to guess, by scanning your Apache configuration files to look for ServerName and ServerAlias directives. This also helps it to figure out where to put the directives to activate HTTPS for the correct site, if you have multiple sites.

If you don’t have a ServerName or ServerAlias for your main site, although Apache might still work, Certbot won’t be able to figure out your domain name automatically. There are ways to get around that, but the simplest and most robust solution is to add those directives to your configuration.

2 Likes

it works, thanks @jared.m, @mnordhoff & @jmorahan

For anyone having the same issue, I just had to add serverName and ServerAlias to my VirtualHost in/etc/apache2/sites-available/000-default.conf

<VirtualHost *:80>
        ServerName mydomain.com
        ServerAlias mydomain.com
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html
        ....

Ran sudo certbot --apache again, and my domain was on the list.

1 Like

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