zoukankan      html  css  js  c++  java
  • (03)Nginx将配置文件default.conf重命名后报Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.解决方案

      今天将Nginx的配置文件 default.conf 重命名为 access_mod.conf 执行重启动命令:

    nginx -s reload -c /etc/nginx/nginx.conf

      然后报错:Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

      因为是重命名,没有修改文件内容,配置语法肯定不会出错,按照提示执行:

    systemctl status nginx.service

      提示:

      ● nginx.service - nginx - high performance web server
      Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
      Active: failed (Result: exit-code) since 日 2020-05-03 22:02:03 CST; 1min 8s ago
      Docs: http://nginx.org/en/docs/
      Process: 7899 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=1/FAILURE)

      5月 03 22:02:03 localhost.localdomain systemd[1]: Starting nginx - high performance web server...
      5月 03 22:02:03 localhost.localdomain nginx[7899]: nginx: [emerg] open() "/etc/nginx/conf.d/access_mod.conf" failed (13: Permission denied) in   /etc/nginx/nginx.conf:31
      5月 03 22:02:03 localhost.localdomain systemd[1]: nginx.service: control process exited, code=exited status=1
      5月 03 22:02:03 localhost.localdomain systemd[1]: Failed to start nginx - high performance web server.
      5月 03 22:02:03 localhost.localdomain systemd[1]: Unit nginx.service entered failed state.
      5月 03 22:02:03 localhost.localdomain systemd[1]: nginx.service failed.

      貌似是权限问题,但是查看了一下之前的 default.conf 和 access_mod.conf权限一致啊,经过一番查找,发现一下解决方法:

      依次执行:

    sudo nginx -c /etc/nginx/nginx.conf
    sudo nginx -s reload

      启动成功了!奇怪的是以后使用

    nginx -s reload -c /etc/nginx/nginx.conf

      依然能启动成功。。。我一直用的是root用户,是不是root用户与sudo之间有啥事。。。

  • 相关阅读:
    CStringArray序列化处理
    【转】C++ Incorrect Memory Usage and Corrupted Memory(模拟C++程序内存使用崩溃问题)
    【转】Native Thread for Win32 C- Creating Processes(通俗易懂,非常好)
    【转】Native Thread for Win32 B-Threads Synchronization(通俗易懂,非常好)
    【转】Native Thread for Win32 A- Create Thread(通俗易懂,非常好)
    【转】关于OnPaint的工作机制
    Window发声函数Beep、MessageBeep
    Sqlite
    VC++ Splash Window封装类CSplash
    通过代码注册COM、DLL组件
  • 原文地址:https://www.cnblogs.com/javasl/p/12830131.html
Copyright © 2011-2022 走看看