首页 > 系统相关 >启动nginx报错nginx: [emerg] unexpected end of file, expecting "}" in /usr/local/nginx/conf/ngi

启动nginx报错nginx: [emerg] unexpected end of file, expecting "}" in /usr/local/nginx/conf/ngi

时间:2023-11-02 22:44:06浏览次数:39  
标签:nginx 报错 location conf local usr

启动nginx报错:“nginx: [emerg] unexpected end of file, expecting “}” in /usr/local/nginx/conf/nginx.conf:118”
重启nginx时,报这么个错:

[root@localhost conf]# /usr/local/nginx/sbin/nginx -s reload
nginx: [emerg] unexpected end of file, expecting “}” in /usr/local/nginx/conf/nginx.conf:118

翻译:错误的文件结尾“}”
所以是nginx.conf的118行缺少或者多了个大括号导致这个报错
所以:

[root@localhost nginx]# cd conf/
[root@localhost conf]# grep -Ei “{|}” nginx.conf
events {
}
http {
server {
location / {
}
location = /50x.html {
}
#location ~ .php$ {
#}
location ~ .php$ {
#}
#location ~ /.ht {
#}
}
#server {
# location / {
# }
#}
#server {
# location / {
# }
#}
}

发现确实少了一个大括号
在nginx.conf中加上一个大括号
[root@localhost conf]# vim nginx.conf
在118行插一个}
然后重启一下nginx

标签:nginx,报错,location,conf,local,usr
From: https://www.cnblogs.com/A121/p/17806557.html

相关文章

  • 【Azure Web Job】Azure Web Job执行Powershell脚本报错 The term 'Select-AzContext'
    问题描述AzureWebJob执行Powershell脚本报错 Select-AzContext:Theterm'Select-AzContext'isnotrecognizedasthenameofacmdlet,function,scriptfile,oroperableprogram.Checkthespellingofthename,orifapathwasincluded,verifythatthepa......
  • nginx coturn socat privoxy opencv 静态编译
    文档说明:只记录关键的地方;发文时间:2023-11-02意义:linux环境,免安装下载后即可使用环境:alpine:3.18dockerclang状态:完善中体验编译结果nginx静态编译关键点nginxusePCRE2libraryonnginx1.21.5hg脚本全称是mercurialopensslzlibpcpre2等静态库......
  • nginx设置允许跨域
    server{listen8088;server_namelocalhost;#charsetkoi8-r;#access_loglogs/host.access.logmain;add_header'Access-Control-Allow-Methods''POST,GET,OPTIONS';add_header......
  • nginx报错 [error] 612#4188: CreateFile() "C:\yjzx\nginx-1.24.0/logs/nginx.pid"
    背景无论是nginx-sstop还是nginx-sreload命令,都会出现这个错误。[error]612#4188:CreateFile()"C:\yjzx\nginx-1.24.0/logs/nginx.pid"failed(2:Thesystemcannotfindthefilespecified)查找logs下nginx.pid文件确实没有创建成功,在网上查找了下了解决办法。发......
  • yum install 报错Error downloading packages
    yuminstallntp报以下错误:Errordownloadingpackages:autogen-libopts-5.18-5.el7.x86_64:[Errno5][Errno2]Nosuchfileordirectoryntp-4.2.6p5-29.el7.centos.2.x86_64:[Errno5][Errno2]Nosuchfileordirectoryntpdate-4.2.6p5-29.el7.centos.2.x86_64:......
  • 7. 从零开始编写一个类nginx工具, HTTP及TCP内网穿透原理及运行篇
    wmproxywmproxy是由Rust编写,已实现http/https代理,socks5代理,反向代理,静态文件服务器,内网穿透,配置热更新等,后续将实现websocket代理等,同时会将实现过程分享出来,感兴趣的可以一起造个轮子法项目++wmproxy++gite:https://gitee.com/tickbh/wmproxygithub:https://github.com/tic......
  • 阿里云服务器 ubuntu 20.04 执行命令添加apt仓库时报错 安装docker报错
    云服务器ECS初始安装docker报错##############出错时候看下面#####################执行命令添加apt仓库时:sudoadd-apt-repositoryppa:ondrej/php&&sudoapt-getupdate报错:sudo:add-apt-repository:commandnotfound解决办法:先执行:apt-get-yinstallsoftware-pro......
  • 在使用docker-compose build一个faq服务Helpy 时报错
    Helpy时报错如下:ERROR:failedtosolve:process"/bin/sh-cbundleinstall--withouttestdevelopment"didnotcompletesuccessfully:exitcode:11ERROR:Service'helpy'failedtobuild:Buildfailed有两种解释这种报错1、修改dockerfile ruby:2.5,然后......
  • vue vue.config.js 配置
    1.开启sourceMap//显示sourceMap,便于调试 //process.env.NODE_ENV有的是dev/prod,有的是development/production,需要自己确认下productionSourceMap:process.env.NODE_ENV!=='production',......
  • 报错 org.springframework.dao.DataIntegrityViolationException: Error attempting t
       原因是持久化层的字段属性 跟数据库的没有对应上,类型不对dao.DataIntegrityViolationException:Errorattemptingtogetcolumn'STATUS'fromresultset.<iftest="record.status!=null">'STATUS'=#{record.status,jdbcType=......