Nginx 启动报错 directive is not allowed here in

发布于:2023-07-04 ⋅ 阅读:(209) ⋅ 点赞:(0)

问题场景

Linux 系统中, Nginx 安装包中默认提供了 conf 文件夹,并且自带的 nginx.conf 配置文件中默认 include 该文件夹下的配置文章。

笔者本次使用 Windows 系统,通过示例也配置了 include 文件夹,不过为了图方便 include 的文件夹和系统自带的 nginx.conf 文件所在文件夹一致。

在这里插入图片描述

分析解决

nginx 错误日志提示:

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

删除 worker_processes 指令后,又报错其它指令不允许。

后来发现是 include 使用通配符的方式导致了自己 include 自己,修改 include 方式即可。

在这里插入图片描述


网站公告

今日签到

点亮在社区的每一天
去签到