哎呦报错啦怎么办?nginx: [emerg] “server“ directive is not allowed here in /usr/local/nginx/conf/nginx.conf53
报错怎么办?不要慌,排它!
1.具体报错提示信息
nginx: [emerg] “server” directive is not allowed here in /usr/local/nginx/conf/nginx.conf:53
nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
2.报错背景介绍
做nginx服务的基于域名的niginx虚拟主机时,修改配置文件vim /usr/local/nginx/conf/nginx.conf 配置具体域名字符集访问日志和相应的站点位置后,保存退出,在nginx -t 检查文件时出现报错。
我的具体配置信息如下
[root@www momo]# vim /usr/local/nginx/conf/nginx.conf
[root@www momo]# nginx -t
nginx: [emerg] "server" directive is not allowed here in /usr/local/nginx/conf/nginx.conf:53
nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
4.排错思路过程
(1)首先,要看报错提示内容,定位故障位置
nginx: [emerg] “server” directive is not allowed here in /usr/local/nginx/conf/nginx.conf:53
nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
根据报错提示表示在53行的service部分不被允许,那就重新进入配置文件,找到53行的service部分,查看是否配置有问题
(2)排错分析及过程
一开始我以为是service部分配置输入有错,就将这部分内容删除后重新设置了一下
结果不如意,重新检测后还是报一样的错误
(3)转机来了
改变思路重新仔细看配置文件内容,真的是看了好久
终于发现问题,一万个我草奔袭而来
发现问题解决问题
分析:
53行的service部分应该是包含在http{}的模块内的,但是我在51行的位置多加了一个} ,相当于把53行的service部分括出了http模块范围外,所以才会提示这部分service服务不被允许。那就简单了,把51行的}去掉应该就解决了。
5.你体验过这样的快乐吗,不,你不懂。
果然分析的没错,看到successful是不是很亲切,酸爽的感觉。虽然问题不大,是小错误,但是体会到了成功的快乐。
[root@www momo]# nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
6.小结一下
(1)故障不可怕,谁遇谁强大,遇到故障不用慌,静下心来对待问题
(2)思路很重要,根据报错提示,定位故障,有方向的查错
(3)没有解决不了的问题,如果有那就是时间问题
哎呦报错啦怎么办?nginx: [emerg] “server“ directive is not allowed here in /usr/local/nginx/conf/nginx.conf53相关推荐
- nginx: [emerg] “location“ directive is not allowed here in /usr/local/nginx/conf/nginx.conf:72
做LNMP实验中的PHP设置完测试页面重启nginx时发现重不不成用nginx -t检测说如下原因 nginx: [emerg] "location" directive is n ...
- nginx: [emerg] “location“ directive is not allowed here
nginx配置出错. D:\nginx>nginx.exe -t nginx: [emerg] "location" directive is not allowed her ...
- nginx: [alert] could not open error log file: open() /usr/local/var/log/nginx/error.log
关于 **nginx: [alert] could not open error log file: open() "/usr/local/var/log/nginx/error.log&q ...
- Nginx 配置问题 server directive is not allowed here in /etc/nginx/nginx.conf:69
前沿 今天在其他服务器上重新配置 nginx.conf 文件,配置结束启动 nginx 发现遇到了这样一个错误,我擦-?我配置文件都是从上个服务器上 复制粘贴过来的,怎么会遇到这个问题呢?百思不得其解 ...
- 解决nginx: [emerg] “ssl“ directive is not allowed here in /etc/nginx/conf.d/xxx.conf:5
精品好文推荐: 部署nginx为自定义服务做代理转发并实现密码认证登录 报错时的情况: 最后发现是位置不对,把ssl的配置移到location之外就OK!
- bee run 报错 main.go:4:2: package myproject/routers is not in GOROOT (/usr/local/go/src/myproject/rout
在当前的项目文件夹中执行命令 go mod init 搞定!
- 【Nginx】错误: [emerg] “proxy_set_header“ directive is not allowed here in D:\sde\phpstudy_pro\...
前言 nginx 1.15.11(下面的代码在此版本测试通过) win10 phpstudy 8.1.1.3 错误 nginx: [emerg] "proxy_set_header" ...
- nginx: [emerg] unknown directive ssl Nginx配置SSL报错
配置环境: nginx:1.8.0版本 CentOS: 6.8版本 问题描述: 本人是在使用nginx 访问方式由http转成https过程中出现的以下问题,参考的是该博文完美解决,大家有什么问题可以 ...
- 报错锦集二“nginx: [emerg] unknown directive “set_real_ip_from“ in /usr/local/nginx/conf/nginx.conf:50 ngi
报错锦集二"nginx: [emerg] unknown directive "set_real_ip_from" in /usr/local/nginx/conf/ng ...
最新文章
- NeurIPS | 3D-BoNet:3D 点云实例分割的新框架
- 列表推导式 python原理_python之列表推导式
- 单板计算机作用上位机,SCB-1单板机的基本操作
- ubuntu使用之-rime
- Linux下的两个经典宏定义【转】
- 手把手教你使用Python做数据分析
- HP 打印机驱动安装报错Return code: 1603解决办法
- 天若OCR文字识别软件
- php图片加密管理系统,8tupian图片加密平台 v3.0
- JavaWeb登录案例带验证码(mysql+servlet+jsp+idea)
- 爬取20万数据,我们深扒了风口上的「享物说」
- 一键在Web端把CAD图自动分割成多张图纸并导出子图或图片
- 地图上制作线路的动画_使用百度地图API制作线路轨迹播放
- 从零开始,带你掌握空状态设计的正确方法
- idea2017激活方式(亲测可用,良心推荐)
- Thinkepad X270 升级内存升级SSD重装WIN7经历(解决HD 620驱动 热键调节亮度)
- 12、微信前端开发利器:WeUI
- Zemax学习笔记——多重结构使用方法
- 巴比特 | 元宇宙每日必读:美国网红利用“AI版的自己”和网友谈恋爱,收费每分钟1美元,GPT时代,数字人会变得更加普及吗?...
- 开发这么多年!垃圾回收你真的了解吗?