nginx: [emerg] unknown directive " " in /etc/nginx/sites-enabled/example.com:3 nginx: [emerg] unknown directive " " in /etc/nginx/sites-enabled/example.com:3 linux linux

nginx: [emerg] unknown directive " " in /etc/nginx/sites-enabled/example.com:3


I had the same problem which was that I copy/pasted the config code from the web and some dirty EOL(end of line) characters where there.

The editor didn't show them, but nginx treated them like a directive.

Just deleted every EOL and added again.


It sounds like you did some copy and paste work here. It's not uncommon to snag some extra characters that are invisible at the end of line (EOL). Try this:

Run your text through this tool:http://www.textfixer.com/tools/remove-line-breaks.php

then fix any breaks that may have been removed and will be affected by the comments.

This worked for me. Hope it works for you.


It looks like the nginx binary was compiled with --without-http_fastcgi_module option.This is not default. Try donwloading or compiling a different binary.

Try running

nginx -V

(with uppercase V) to see what options were used to compile the nginx.