I know this is an old thread, but posting this in case it helps others with the same issue.
I got the error when creating a config file from the CWP user panel "edit content" file link. It was solved by pasting the directives into Notepad**, going to Edit>EOL Conversion>Unix (LF), saving the file, then uploading in the user panel file manger interface.
If you do this but still see the error you have a syntax issue.