Ubuntu

即使停止,nginx也會阻塞埠

  • August 17, 2019

之後

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

aaaand 它還在嗎?

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

你自己的程序列表應該告訴你發生了什麼:

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

看看它在哪裡說嵌入式 nginx。

因此,當您執行service nginx stop此命令時,請停止系統 nginx。

由 gitlab 執行的 nginx 是另一個你必須單獨處理的。如,如果你不想使用 Gitlab 的嵌入式 nginx,你需要解綁

引用自:https://unix.stackexchange.com/questions/536058