Let's encrypt SSL certificate request 404 not found

Operating system: Ubuntu
OS version: 20.04 LTS
I use minimal install with LEMP. I chose don’t create a virtual server for me in the wizard. I haven’t update packages before creating a virtual server.

When I first create a virtual server, it shows the error. After this, creating certificates always show this error. I want to mention that this is my about 5 times install. The previous install can create certificates normally, but for these 2 installs the problem arises. Previously, I tried to use LAMP. Do system update before creating a virtual server but with no luck… I need help very much.

Requesting a certificate for example.com, www.example.com from Let's Encrypt ..
.. request failed : Web-based validation failed :
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator webroot, Installer None
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for www.example.com
http-01 challenge for example.com
Using the webroot path /home/jiachen/public_html for all unmatched domains.
Waiting for verification...
Challenge failed for domain www.example.com
Challenge failed for domain example.com
http-01 challenge for www.example.com
http-01 challenge for example.com
Cleaning up challenges
Some challenges have failed.
IMPORTANT NOTES:
 - The following errors were reported by the server:

   Domain: www.example.com
   Type:   unauthorized
   Detail: Invalid response from
   http://www.example.com/.well-known/acme-challenge/QjhmmZpxk_ZkHVWSczFaRpZqpcLn0dWLHMs31-RO1L4
   [172.96.196.61]: "<html>\r\n<head><title>404 Not
   Found</title></head>\r\n<body>\r\n<center><h1>404 Not
   Found</h1></center>\r\n<hr><center>nginx/1.18.0 (Ub"

   Domain: example.com
   Type:   unauthorized
   Detail: Invalid response from
   http://example.com/.well-known/acme-challenge/3NM3fcRg2jZCcLSuoNJ4c2Tgu-rdbhVTWvzh7tTjXDM
   [172.96.196.61]: "<html>\r\n<head><title>404 Not
   Found</title></head>\r\n<body>\r\n<center><h1>404 Not
   Found</h1></center>\r\n<hr><center>nginx/1.18.0 (Ub"

   To fix these errors, please make sure that your domain name was
   entered correctly and the DNS A/AAAA record(s) for that domain
   contain(s) the right IP address.
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
   DNS-based validation failed :
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator manual, Installer None
Obtaining a new certificate
Performing the following challenges:
dns-01 challenge for www.example.com
dns-01 challenge for example.com
Running manual-auth-hook command: /etc/webmin/webmin/letsencrypt-dns.pl
Running manual-auth-hook command: /etc/webmin/webmin/letsencrypt-dns.pl
Waiting for verification...
Challenge failed for domain www.example.com
Challenge failed for domain example.com
dns-01 challenge for www.example.com
dns-01 challenge for example.com
Cleaning up challenges
Running manual-cleanup-hook command: /etc/webmin/webmin/letsencrypt-cleanup.pl
Running manual-cleanup-hook command: /etc/webmin/webmin/letsencrypt-cleanup.pl
Some challenges have failed.
IMPORTANT NOTES:
 - The following errors were reported by the server:

   Domain: www.example.com
   Type:   dns
   Detail: DNS problem: NXDOMAIN looking up TXT for
   _acme-challenge.www.example.com - check that a DNS record exists for
   this domain

   Domain: example.com
   Type:   dns
   Detail: DNS problem: NXDOMAIN looking up TXT for
   _acme-challenge.example.com - check that a DNS record exists for
   this domain

Another problem is that cron jobs maybe have errors as it mails me this.

Error while processing /etc/awstats/awstats.conf
Error: SiteDomain parameter not defined in your config/domain file. You must edit it for using this version of AWStats.
Setup ('/etc/awstats/awstats.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).

And yet another problem. If I open example.com:10000 with normal chrome, it will always show connection lost and I can’t do anything. Seems like a SSL problem. Then if I open with a private window, I won’t meet this problem.

Thanks in advance.

I saw this thread is likely having the same problem as mine. But in my case, even subdomains have this problem. And now it evolves from 404 not found to ERR_CONNECTION_REFUSED, for all pages. Restarting the server didn’t solve connection refused.

Also, I tried to request a certificate in webmin. It showed another error.

### Failed to request certificate : No virtual host matching example.com was found

Not creating a virtual server in the Post-Installation wizard causes this problem. If I let it be created, SSL works. My purpose to do so is to be able to manually set my admin user name. Now I find another way to do this, so I can bypass this problem.

Let it create a virtual server for me in the wizard. Then go to Change Domain Name. Here can change the user name and its home directory. However, the default MySQL database name isn’t changed. It has nothing at this time, though. I just deleted it.

???

I never had that problem since lets encrypt or whatever ssl provider worked and I’ve installed virtualmin. Are you sure you have server setup properly? Perhaps something is not set up correctly I guess you missed some steps in install process… - means its not just execute install script, once you install your system you have to prepare it for virtualmin proper install… like hostname, dns on your registar - if you going to manage dns on your server etc. Bypassing problem is not solving problem which lead you to more problems… eh?! - what is your post about? - spamming forums?

It’s great that you haven’t met the problem. However, I can find several posts that met a similar problem. Surely, hostname and DNS are configured. And originally I posted my domain so you could check for DNS and so on, but as I solved the problem, I have edit to hide the domain now.

And why saying I’m spamming forums? I’m just sharing a solution. The problem is definitely a bug that I can reproduce every time I installed it. Or maybe you’re right that some other things are not properly configured. What are other things you can think of? But I have achieved what I want in another way so actually, it’s not important to me now. I can take your advice when I build a website the next time, though.

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