I fixed this by putting a newline at the end of the conf file.
As said by @Konrad90, adding a newline to the end of each file fixed this issue for me.
newline fixed the issue. Thank You!
Fixed adding the new line as suggested. Here’s a one-liner:
for f in /etc/apache2/sites-available/*; do sed -i '$a\' "$f"; done
Credit: http://stackoverflow.com/questions/10082204/add-a-newline-only-if-it-doesnt-exist
Correct!!
Just add an empty line at the end of your .conf file into the directory sites-available/
Thank You!
one newline at bottom fix this!
Thanks from me too, newline sorted it, now on to the next issue in my slightly sketchy apache setup, all sites appear to redirect to one default
Just created an account here to confirm that the newline solved this for me as well. I would have never found this myself, so thanks a lot!
Since a stand-alone apache config test does not report such a syntax error, does that mean that the letsencrypt certbot is overly sensitive to it?
Yes, it is too sensitive.
I created a new file /etc/apache2/sites-available/my.domain.conf and then I was facing similar problem with configtest as cray or groovyben008 did: not matched and tags, although visually they looked OK.
It was caused by three garbage bytes - UTF-8 BOM - which my editor had put in front of . Theese bytes are invisible in most text viewers and Apache conf parser isn’t smart enough to ignore them.
So if configtest reports inexplicable error, look at the file with hexa viewer xxd.
- I fixed this problem just creating a file (replace domain.com with your domain) in /etc/apache2/sites-available/domain.com-le-ssl.conf
ServerAdmin webmaster@domain.comServerName domain.com
ServerAlias www.domain.com
DirectoryIndex index.html index.php
DocumentRoot /var/www/html/domain.com/public_htmlLogLevel warn
ErrorLog /var/www/html/domain.com/log/error.log
CustomLog /var/www/html/domain.com/log/access.log combined
- Then run the command certbot