certbot does not recognize the added VirtualHost Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of certbot does not recognize the added VirtualHost without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I’m trying to use certbot to get a certificate for my http server running nextcloud (archarm on a raspi). When I run: $ sudo certbot --apache, I get:

$ sudo certbot --apache      
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
No names were found in your configuration files. Please enter in your domain
name(s) (comma and/or space separated)  (Enter 'c' to cancel): 

I then enter my domain: example.duckdns.org upon which I get:

Obtaining a new certificate
Performing the following challenges:
http-01 challenge for example.duckdns.org
Cleaning up challenges
Unable to find a virtual host listening on port 80 which is currently needed for Certbot to prove to the CA that you control your domain. Please add a virtual host for port 80.

While I do have example_duckdns.conf in /etc/httpd/conf/extra which looks like:

<Directory /var/www/html/nextcloud>
    Require all granted

<VirtualHost *:80>
    DocumentRoot "/var/www/html/nextcloud"
    ServerName example.duckdns.org
    ServerAlias example.duckdns.org
    ServerAdmin example@mymail.com
    ErrorLog "/var/log/httpd/error_log_example_duckdns_org"
    CustomLog "/var/log/httpd/access_log_example_duckdns_org" combined

And I get:

$ apachectl configtest        
Syntax OK

What do I have wrong?

Using: Apache/2.4.43


Sure, your /etc/httpd/conf/extra looks correct, but does your main Apache configuration file (or any file included by it) have anything like Include /etc/httpd/conf/extra or IncludeOptional /etc/httpd/conf/* in it anywhere?

We are here to answer your question about certbot does not recognize the added VirtualHost - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji