gpt4 book ai didi

ubuntu - 无法重启 nginx 网络服务器

转载 作者:行者123 更新时间:2023-12-04 19:09:38 25 4
gpt4 key购买 nike

我有一个 DigitalOcean 液滴,在将 laravel 应用程序投入生产后,我尝试了以下命令:

sudo systemctl 重新加载 nginx

但我得到这个错误:

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

我跑了 sudo nginx -t 看看是否有错误,但 conf 和语法没问题,之后我跑了:

须藤纳米/var/log/nginx/error.log

我得到了这个:
2020/01/16 14:53:53 [notice] 14195#14195: signal process started
2020/01/16 14:53:53 [error] 14195#14195: invalid PID number "" in "/run/nginx.pid"
2020/01/16 14:53:53 [emerg] 14198#14198: bind() to 0.0.0.0:443 failed (98: Address already in use)
2020/01/16 14:53:53 [emerg] 14198#14198: bind() to 0.0.0.0:80 failed (98: Address already in use)
2020/01/16 14:53:53 [emerg] 14198#14198: bind() to 0.0.0.0:443 failed (98: Address already in use)
2020/01/16 14:53:53 [emerg] 14198#14198: bind() to 0.0.0.0:80 failed (98: Address already in use)
2020/01/16 14:53:53 [emerg] 14198#14198: bind() to 0.0.0.0:443 failed (98: Address already in use)
2020/01/16 14:53:53 [emerg] 14198#14198: bind() to 0.0.0.0:80 failed (98: Address already in use)
2020/01/16 14:53:53 [emerg] 14198#14198: bind() to 0.0.0.0:443 failed (98: Address already in use)
2020/01/16 14:53:53 [emerg] 14198#14198: bind() to 0.0.0.0:80 failed (98: Address already in use)
2020/01/16 14:53:53 [emerg] 14198#14198: bind() to 0.0.0.0:443 failed (98: Address already in use)
2020/01/16 14:53:53 [emerg] 14198#14198: bind() to 0.0.0.0:80 failed (98: Address already in use)
2020/01/16 14:53:53 [emerg] 14198#14198: still could not bind()

知道为什么我无法重新启动我的网络服务器,我的网络仍然可见,但我似乎无法重新启动或重新加载 nginx。

最佳答案

似乎是 /run/nginx.pid 的问题由于某种原因,这是空的。

首次检查流程ps -ef | grep nginx为 nginx 找到三个根进程(在我的情况下为 7388)

root@keybu:/var/www/keybu_production#  ps -ef | grep nginx
root 2314 9443 0 21:28 pts/0 00:00:00 grep nginx
root 7388 1 0 2019 ? 00:00:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
nginx 23709 7388 0 Jan15 ? 00:00:04 nginx: worker process

然后杀死它:
kill -9 7388
  • 检查是否没有运行 nginx 进程,如果它也被杀死。

  • 然后重启 nginx service nginx start
  • 第二种解决方案是将进程的 ID 号写入 /run/nginx.pid。但还没有测试
  • 关于ubuntu - 无法重启 nginx 网络服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59776773/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com