linux - 如何停止nginx?它不断杀死一个进程并打开一个具有不同 pid 的新进程

标签 linux ubuntu nginx systemd

我通过 ubuntu 包管理器安装了 nginx。我尝试运行 sudo nginx 并获取

nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)

好的。运行

sudo netstat -plant | grep 8
tcp     0    0 0.0.0.0:80    0.0.0.0:*     LISTEN    3593/nginx -g daemo
tcp6    0    0 :::80         :::*          LISTEN    3594/nginx -g daemo

看来nginx还在运行。

sudo nginx -s stop

我尝试阻止它,然后重新检查。

sudo netstat -plant | grep 8

tcp     0    0 0.0.0.0:80    0.0.0.0:*     LISTEN    3736/nginx -g daemo
tcp6    0    0 :::80         :::*          LISTEN    3736/nginx -g daemo

所以基本上它只是改变了 pid 号。每次它这样做而不是杀死它。我想它会终止该进程并打开一个新进程。

我怎样才能真正阻止它?

最佳答案

我不得不使用服务守护进程。所以 service nginx stop 而不是 nginx -s stop

显然服务守护进程是控制 nginx 的那个,当你使用 -s 标志时你只是在调用它。在这种情况下我需要直接访问它

关于linux - 如何停止nginx?它不断杀死一个进程并打开一个具有不同 pid 的新进程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31527288/

相关文章:

linux - 如何自定义窗口菜单(linux ubuntu)

Django Gunicorn Nginx "connection reset by peer while reading response header"

php - 在 Nginx 反向代理后面运行 Apache(使用 .htaccess)应用程序

php - 阻止 nginx 重定向到 index.php

mysql - MariaDB 安装移动了我的 Mysql 数据库

linux - 更新 GNU/Linux 内核以在每个数据包中发送 n 个 TCP 数据包

linux - 如何计算 GPU 负载

ubuntu - vagrant 和我的虚拟机 - vagrant 重新加载 - 默认 : VM not created. 继续

linux - Virtualbox 上的 Ubuntu VM 不断中止

jquery - 我怎样才能像C语言一样编写jQuery?