Saturday, July 22, 2017

Resolve LetsEncrypt - Server only speaks HTTP, not TLS Error

You can setup SSL on your website using LetsEncrypt. I have encountered a few times when you want to add new domain to the LetsEncrypt, it throws the following error.

Waiting for verification...
Cleaning up challenges
Failed authorization procedure. xxxxxxxxx (tls-sni-01): urn:acme:error:malformed :: The request message was malformed :: Server only speaks HTTP, not TLS

IMPORTANT NOTES:
 - The following errors were reported by the server:

   Domain: XXXXXXX
   Type:   malformed
   Detail: Server only speaks HTTP, not TLS

I spent hours resolving this issue figuring out whether there is a problem on my VPS or web server configuration or VirtualHost config.

To resolve the issue, add the following lines to your Apache virtual host conf file. On Apache2, it is available under /etc/apache2/sites-available/000-default-le-ssl.conf

SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
Include /etc/letsencrypt/options-ssl-apache.conf

Then add ServerName to your 000-default.conf file.

ServerName domain-name

Last thing, restart your apache2

sudo service apache2 restart

You should now be able to generate SSL LetsEncrypt certificate via

sudo letsencrypt -d domain-name


Happy Reading !!!