码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • Nginx 报错问题汇总(持续更新ing)


    目录

    一、nginx: [emerg] invalid number of arguments in "include" directive in C:\Program Files\nginx-1.15.4/conf/nginx.conf:61

    总结:

    二、nginx: [error] OpenEvent("Global\ngx_reload_2152") failed (5: Access is denied)

    解决方案:

    三、nginx: [emerg] unknown directive "stream" in /etc/nginx/nginx.conf:13

    问题原因

    解决办法


    一、nginx: [emerg] invalid number of arguments in "include" directive in C:\Program Files\nginx-1.15.4/conf/nginx.conf:61

    1. 时间:2022-11-25
    2. 操作系统:Windows

     我是执行 nginx -s reload 时提示报错信息:

    大致意思是:nginx: [emerg]在C:\Program Files\ nginx-1.15.4/conf/nginx.conf中"include"指令中的参数数量无效

    根据报错信息的指示去 nginx.conf 文件的第61行代码查看:

    	include C:/Program Files/nginx-1.15.4/conf/conf.d/*.conf;

    我反反复复确定了单词没有拼错、路径没有写错,最后的英文分号也有。后来在网上搜索了一遍,才知道英文单词之间不能留有空格!!!(Program Files 之间有空格)

    1. # 修改后
    2. include C:/ProgramFiles/nginx-1.15.4/conf/conf.d/*.conf;

    再用 nginx -t 检查一遍,没有报错了:

            但是这样nginx依然检测不到这个路径,因为Windows中的 C:/Program Files 文件夹是有空格的,除非你修改这个文件夹的名字删除空格,但是这样就会影响到其他Windows上的程序,所以建议nginx还是不要安装在有空格、中文名称的目录下为好!

    总结:

    在nginx配置文件中填写的路径格式和目录(文件夹)名称中不能有空格、中文、反斜杠(\)!!!

    二、nginx: [error] OpenEvent("Global\ngx_reload_2152") failed (5: Access is denied)

    1. 时间:2022-11-25
    2. 操作系统:Windows

    使用 nginx -t 检测没有报错信息,反而使用 nginx -s reload 时出现报错:

    大致报错意思是:nginx: [error] OpenEvent("Global\ngx_reload_2152") failed(5:访问被拒绝)

    第一反应以为是权限问题导致的,然后用管理员权限进入cmd,依然是这个报错信息。

    解决方案:

    先进入nginx的安装目录,使用 start nginx.exe,再使用 nginx -s reload 即可成功!!!

    三、nginx: [emerg] unknown directive "stream" in /etc/nginx/nginx.conf:13

    1. 时间:2023-02-14
    2. 操作系统:CentOS 7.6
    1. [root@k8s-master1 work]# nginx -t
    2. nginx: [emerg] unknown directive "stream" in /etc/nginx/nginx.conf:13
    3. nginx: configuration file /etc/nginx/nginx.conf test failed

    问题原因

    因为在 nginx 中增加了这个 steam 模块配置:

    解决办法

    1. #1. 安装阿里云 epel.repo 源(如果第二步执行不成功,再执行这步,记得提前备份好原来的 epel.repo)
    2. curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
    3. yum -y install epel-release
    4. #2. 应该是缺少 modules 模块
    5. yum -y install nginx-all-modules.noarch
    6. # 然后在用 nginx -t 就好了
    7. [root@k8s-master1 ~]# nginx -t
    8. nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    9. nginx: configuration file /etc/nginx/nginx.conf test is successful

     

  • 相关阅读:
    centos中nacos设置开机自启动
    为什么多级页表比单级页表更节省内存?
    系统架构设计师-计算机系统基础知识(1)
    (02)Cartographer源码无死角解析-(24) Collator类与顺序多队列类
    source activate my_env 和conda activate my_env 有什么区别
    算法训练营第三天 | 203.移除链表元素、707.设计链表 、206.反转链表
    type和interface的异同?
    查看当前cmake版本支持哪些版本的Visual Studio
    移动应用性能工具探索之路
    八种button的hover效果
  • 原文地址:https://blog.csdn.net/weixin_46560589/article/details/128038731
  • 最新文章
  • 沪漂五周年了:我越来越迷茫了
    Agentic Skill Routing 实战:别再把所有 Skill 塞进 AI Agent 上下文
    MySQL-Seconds_behind_master的精度误差
    [MAF预定义ChatClient中间件-03]CachingChatClient——利用缓存省钱省时间
    AI的至暗历史:从万众期待到被政府撤资,AI的两次死亡徘徊
    Agent OS :五种驯服不确定性的范式
    PortSwigger SQL注入LAB11
    数据库即时编译JIT
    [Begin]AI Learn Data Day 0
    深度学习进阶(二十七)现代 LLM 的核心架构设计其二:SwiGLU
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
小工具 小游戏
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1

京公网安备 11010502049817号