问题描述
在配置nginx的配置文件server模块的时候报如下错误:
*"location" directive is not allowed here in /usr/local/nginx/conf.d/vhost_1.conf:10*
下图是我的配置文件,乍一看没有问题
其实这些我们另外添加的模块要放在http或者server模块下才能使用

修改解决

用nginx -t来测试一下语法,发现就没有问题了

“location“ directive is not allowed here in /usr/local/nginx/conf.d/vhost_1.conf:10
最新推荐文章于 2026-06-19 14:38:36 发布

2万+

被折叠的 条评论
为什么被折叠?



