Obtaining a Let’s Encrypt SSL Certificate fails on a freshly installed forge server with:”ERROR: Challenge is invalid!”

I tried to create a SSL certificate on a new digitalocean server administered by forge (a Laravel deployment and server administration service), but eventually failed with an error:

ERROR: Challenge is invalid! (returned: invalid) (result: [“type”] “http-01”

After some testing and research (I tried removing the .htaccess Basic Auth, changing the hostname, changing the webroot from /public to /, removing the installed APP, setting the timezone, updating the time, and more…) I tried to manually retrieve the cert with acme.sh.

Therefore i installed “plocate”, because i had no clue, where acme.sh actually was installed. But “locate acme” found like… nothing. just some readmes in the /root folder. I guess, “acme.sh” is to be found somewhere else in the forge backyard.

So i manually installed “acme.sh” with

curl https://get.acme.sh | sh source ~/.bashrc

and was just about to install my cert manually, when I thought:”Let’s give it a last try!” and tried to create the cert from the forge GUI.

And voilà, it worked like a charm. I do wonder now… Was it solved, because i manually installed “acme.sh”, or was it just a properly timed coincedence, because some DNS record has just updated? Shouldn’t be possible, because it was the first time i used the DNS for this server and the subdomain wasn’t even created before that.

But well, magic happens all the time, especially if you are a backend developer, so i take a present when i get one and don’t think about it for too long. Thats how we can survive without losing our smile… and our sanity 🙂