Error reported :nginx 报错[emerg] 32408#14080: unknown directive "锘? in E:\nginx-1.18.0/conf/nginx.conf:3
Reason : 使用nginx服务时,用txt记事本打开编辑了nginx.conf文件
When software such as Notepad that comes with Windows saves a file encoded in UTF-8, three invisible characters (0xEF 0xBB 0xBF, or BOM) will be inserted at the beginning of the file. It is a string of hidden characters used to let editors such as Notepad identify whether the file is encoded in UTF-8.
Solution :
- Copy
nginx.conf
the file contents, create a new onenginx.conf
, and delete the previous one. - Then select Open with,
VSCode
,webStrom
, and other editors to reopennginx.conf
the file.
- Restart nginx