[Solved] Nginx Startup Error: directive is not allowed here in

Problem scenario

In the Linux system, the conf folder is provided in the nginx installation package by default and the configuration file of nginx.conf includes the configuration articles in this folder by default.

I use the windows system this time, and also configures the include folder through the example. However, for the convenience of the figure, the include folder and the folder of nginx.conf file are consistent.

Analyze and solve:

Nginx error log prompt:

“worker_processes” directive is not allowed here in D:/nginx-1.22.0/conf/nginx. conf:3

After deleting the worker_processes instruction, an error is reported that other instructions are not allowed.

Later, it was found that the use of wildcards in include led to the inclusion of yourself. You can modify the include method.

Read More: