January 19, 2017

How to fix syntax error configuring Lets Encrypt SSL with certbot

I was trying to install a SSL certificate on my Digital Ocean VPS running Centos 7 with apache 2.4 and followed all the guidelines from one of Digital Oceans

Everything looked fine until I got to the end of the certbot configuration and it failed with this error:

httpd: Syntax error on line 353 of /etc/httpd/conf/httpd.conf: Syntax error on line 24 of /etc/httpd/vhost.d/mydomain-le-ssl.conf: Expected </VirtualHost> but saw </VirtualHost></IfModule>`

After some googling I found this article that put me in the right direction.

The fix was simply to add a new line at the end of my conf file (which was line 24 like the error stated).

Also if you get a verification or communcation error when certbot is verifying the domain it could be like me that I was using
cloudflare.com for my domains DNS. Turn off DNS and http proxy while configuring certbot.

Then you can turn it on again after you are finished configuring.