即使停止,nginx也会阻塞端口

即使停止,nginx也会阻塞端口

之后

service nginx stop

我检查了端口 80:

ps ax | grep nginx
  898 ?        Ss     0:00 runsv nginx
  943 ?        S      0:00 svlogd -tt /var/log/gitlab/nginx
 4063 pts/0    S+     0:00 grep --color=auto nginx
29681 ?        Ss     0:00 nginx: master process /opt/gitlab/embedded/sbin/nginx -p /var/opt/gitlab/nginx
29682 ?        S      0:00 nginx: worker process
29683 ?        S      0:00 nginx: worker process
29684 ?        S      0:00 nginx: worker process
29685 ?        S      0:00 nginx: worker process
29686 ?        S      0:00 nginx: worker process
29687 ?        S      0:00 nginx: worker process
29688 ?        S      0:00 nginx: worker process
29689 ?        S      0:00 nginx: worker process
29690 ?        S      0:00 nginx: worker process
29691 ?        S      0:00 nginx: worker process
29692 ?        S      0:00 nginx: worker process
29693 ?        S      0:00 nginx: worker process
29694 ?        S      0:00 nginx: worker process
29695 ?        S      0:00 nginx: worker process
29696 ?        S      0:00 nginx: worker process
29697 ?        S      0:00 nginx: worker process
29698 ?        S      0:00 nginx: cache manager process

然后我杀死了所有这些进程

kill -9 29681 29682 29683 29684 29685 29686 29687 29688 29689 29690 29691 29692 29693 29694 29695 29696 29697 29698

aaa它还在那里吗?

ps ax | grep nginx:
 9074 ?        Ss     0:00 nginx: master process /opt/gitlab/embedded/sbin/nginx -p /var/opt/gitlab/nginx
 9105 ?        S      0:00 nginx: worker process
 9107 ?        S      0:00 nginx: worker process
 9108 ?        S      0:00 nginx: worker process
 9109 ?        S      0:00 nginx: worker process
 9110 ?        S      0:00 nginx: worker process
 9111 ?        S      0:00 nginx: worker process
 9112 ?        S      0:00 nginx: worker process
 9113 ?        S      0:00 nginx: worker process
 9114 ?        S      0:00 nginx: worker process
 9115 ?        S      0:00 nginx: worker process
 9116 ?        S      0:00 nginx: worker process
 9117 ?        S      0:00 nginx: worker process
 9118 ?        S      0:00 nginx: worker process
 9119 ?        S      0:00 nginx: worker process
 9120 ?        S      0:00 nginx: worker process
 9121 ?        S      0:00 nginx: worker process
 9122 ?        S      0:00 nginx: cache manager process
 9123 ?        S      0:00 nginx: cache loader process
 9297 pts/0    R+     0:00 grep --color=auto nginx:

如何以及为何?这使得它与一个错误非常令人困惑,我试图追踪我收到的错误bind() to 0.0.0.0:80 failed (98: Address already in use)- nginx 正在阻塞自己还是什么? :D

答案1

您自己的进程列表应该告诉您发生了什么:

nginx: master process /opt/gitlab/embedded/sbin/nginx

看看哪里说嵌入式 nginx。

因此,当您运行service nginx stop此命令时,请停止系统 nginx。

gitlab 运行的 nginx 是您必须单独处理的另一个。例如,如果你不想使用 Gitlab 的嵌入式 nginx,则需要分拆它。

相关内容