'Using certbot to authenticate domain

My domain is advice.com. I'm running Apache webserver on Ubuntu 20.04 LTS. I've configured domain name as per this link: Within my internet, I can access domain name www.advice.com which is mapped as 192.168.0.xxx As per this tutorial https://www.digitalocean.com/community/tutorials/how-to-create-a-self-signed-ssl-certificate-for-apache-in-ubuntu-20-04, self signed certificate was generated for domain. However, it shows warning of not secure. I want to fetch certificates using certbot. When I ran this command ```sudo certbot --apache`` It produces following output:

http-01 challenge for www.advice.com Cleaning up challenges Some challenges have failed. 
IMPORTANT NOTES. - The following errors were reported by the server: 
Domain: www.advice.com 
Type: unauthorized 
Detail: Invalid response from http://www.advice.com/.well-known/acme-challenge/_fasLpkG_oxH7gK3K78GEG1L6x9TFRlGpm__5QiIWr4[3.33.152.147]: 404 
To fix these errors, please makes sure that your domain name was entered correctly and the DNS A/AAA record(s) for that domain contain(s)the right IP address. 

Looking into the solutions for this error, I also added acme-challenge directory in configuration file. I can access this file http://advice.com/.well-known/acme-challenge/test-file-1234 Here is the configuration of server:

   ServerName advice.com
   ServerAlias www.advice.com
   DocumentRoot /var/www/advice.com
   SSLEngine on
   SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
   SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName advice.com
    ServerAlias www.advice.com
    DocumentRoot /var/www/advice.com
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    Redirect / https://advice.com/
    DocumentRoot /var/www/advice.com/.well-known/acme-challenge
  <Location "/.well-known/acme-challenge/">
    #do nothing special for challenges / ignore bad requests
    RedirectMatch 403 "^(?!/\.well-known/acme-challenge/[\w-]{43}$)"
  </Location>
  <Location "/">
    #redirect all other requests to HTTPS
    Redirect permanent "/" https://%{HOST}/$1
  </Location>
</VirtualHost>

Is it something related to configuration file? I just want to assign domain name to ubuntu server and make it secure for further work.



Solution 1:[1]

please make sure that you correctly added the A record pointing to your host IP address, and if error still exist, delete AAA record and just keep the A record

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 MALAYALI HACKERZ