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之间有啥事。。。

  • 相关阅读:
    JWT(JSON WEB TOKEN) / oauth2 / SSL
    Guice 学习
    九 fork/join CompletableFuture
    二 lambda表达式
    IDEA 热部署 + 下载jar包放到maven中
    微服务学习一 微服务session 管理
    一 Optional
    八 线程池(待续)
    七 内置锁 wait notify notifyall; 显示锁 ReentrantLock
    六 多线程问题
  • 原文地址:https://www.cnblogs.com/javasl/p/12830131.html
Copyright © 2011-2022 走看看