I’m installing a certificate for my domain on Ubuntu 16.04 with Apache 2. I executed the command certbot --apache
and selected my domains gurgaonvivah.com and www.gurgaonvivah.com and got this response:
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for gurgaonvivah.com
http-01 challenge for www.gurgaonvivah.com
Waiting for verification...
Cleaning up challenges
Failed authorization procedure. www.gurgaonvivah.com (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://www.gurgaonvivah.com/.well-known/acme-challenge/tsKwRl5qXfk-6VYVeIax31RWyxbaS11ntglSKywt_RE: "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p", gurgaonvivah.com (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://gurgaonvivah.com/.well-known/acme-challenge/38Zwae_-o66t54bSNqudtPbiZTeMLRilK_iNXIjXLIQ: "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p"
IMPORTANT NOTES:
- The following errors were reported by the server:
Domain: www.gurgaonvivah.com
Type: unauthorized
Detail: Invalid response from
http://www.gurgaonvivah.com/.well-known/acme-challenge/tsKwRl5qXfk-6VYVeIax31RWyxbaS11ntglSKywt_RE:
"<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p"
Domain: gurgaonvivah.com
Type: unauthorized
Detail: Invalid response from
http://gurgaonvivah.com/.well-known/acme-challenge/38Zwae_-o66t54bSNqudtPbiZTeMLRilK_iNXIjXLIQ:
"<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p"
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.
I have seen similar questions here and tried a few things. Firstly there’s actually no file 38Zwae_-o66t54bSNqudtPbiZTeMLRilK_iNXIjXLIQ in acme-challenge folder. The permissions of the folders are 755.
I added a test file aa.txt in acme-challenge folder and can access it via a browser http://www.gurgaonvivah.com/.well-known/acme-challenge/aa.txt but if I use a curl command from shell
curl -i http://www.gurgaonvivah.com/.well-known/acme-challenge/aa.txt | cat -A
I get a 404 response again. What should I do?