Question

Cannot create a ssl certificate with letsencrypt and certbot

Hi there I cannot create a ssl certificate with letsencrypt and certbot for my website. Can someone please help me. The old website is still running on another server but the new website I have constructed is on the new server which I am trying to create the cert.

This is the command I run in the bash sudo certbot --nginx -d glima.is -d www.glima.is

And here is the results when certbot runs.

Failed authorization procedure. www.glima.is (http-01): urn:ietf:params:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://www.glima.is/.well-known/acme-challenge/i0H7vf5uI1BFKfb_EFpxHIhWtW6b4_UlaXr2lrUcXy8 [185.112.145.172]: “<!DOCTYPE html>\n<html>\n<head>\n <title>i-MSCP internet - Multi Server Control Panel - Error 404</title>\n <meta http-equiv='”, glima.is (http-01): urn:ietf:params:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://glima.is/.well-known/acme-challenge/vnTQAlnaIHH0XwWODjX39TvSVDHBvwsytbTw2ETSN-4 [185.112.145.172]: “<!DOCTYPE html>\n<html>\n<head>\n <title>i-MSCP internet - Multi Server Control Panel - Error 404</title>\n <meta http-equiv='”

IMPORTANT NOTES:

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Amazingly in my case (on CentOS 8), the solution was just:

systemctl restart nginx

As a note, I mostly use nginx -s reload instead of the above command, and apparently, sometimes it’s not enough :)

Someone said that might be related to the IP/server change and some time might be needed for DNS propagation. however, I cant confirm/reject that thought.

Greetings!

It looks like your web application is redirecting this traffic, so LE is unable to verify the .well-known directory over http. You can either add an exclusion for the .well-known directory in your Nginx configuration, or try doing a DNS challenge instead of HTTP. I found a guide for doing the DNS challenge here:

https://www.bennadel.com/blog/3420-obtaining-a-wildcard-ssl-certificate-from-letsencrypt-using-the-dns-challenge.htm

Here is something I found for setting up the .well-known directory in your Nginx config:

https://community.letsencrypt.org/t/how-to-nginx-configuration-to-enable-acme-challenge-support-on-all-http-virtual-hosts/5622

Jarland