我使用以下命令在 Fedora 32 中停止 nginx:
[dolphin@MiWiFi-R4CM-srv nginx]$ sudo systemctl stop nginx
此命令没有任何输出(成功吗?)。但是当我使用此命令检查 nginx 进程时:
[dolphin@MiWiFi-R4CM-srv nginx]$ ps aux|grep nginx
root 464167 0.0 0.0 27048 1972 ? Ss 12:20 0:00 nginx: master process nginx
nginx 464168 0.0 0.0 37960 4116 ? S 12:20 0:00 nginx: worker process
nginx 464169 0.0 0.0 37960 4184 ? S 12:20 0:00 nginx: worker process
nginx 464170 0.0 0.0 37960 4184 ? S 12:20 0:00 nginx: worker process
nginx 464171 0.0 0.0 37960 4184 ? S 12:20 0:00 nginx: worker process
nginx 464172 0.0 0.0 37960 4116 ? S 12:20 0:00 nginx: worker process
nginx 464173 0.0 0.0 37960 4184 ? S 12:20 0:00 nginx: worker process
nginx 464174 0.0 0.0 37960 4120 ? S 12:20 0:00 nginx: worker process
nginx 464175 0.0 0.0 37960 4120 ? S 12:20 0:00 nginx: worker process
nginx 464176 0.0 0.0 37960 4120 ? S 12:20 0:00 nginx: worker process
nginx 464178 0.0 0.0 37960 4120 ? S 12:20 0:00 nginx: worker process
nginx 464180 0.0 0.0 37960 4120 ? S 12:20 0:00 nginx: worker process
nginx 464182 0.0 0.0 37960 4120 ? S 12:20 0:00 nginx: worker process
nginx 464183 0.0 0.0 37960 4120 ? S 12:20 0:00 nginx: worker process
nginx 464184 0.0 0.0 37960 4120 ? S 12:20 0:00 nginx: worker process
nginx 464185 0.0 0.0 37960 4120 ? S 12:20 0:00 nginx: worker process
nginx 464186 0.0 0.0 37960 4120 ? S 12:20 0:00 nginx: worker process
dolphin 465557 0.0 0.0 216220 2384 pts/12 S+ 12:32 0:00 grep --color=auto nginx
进程似乎不受控制。为什么进程还活着?如何在 Fedora 32 中正确关闭 nginx?
[dolphin@MiWiFi-R4CM-srv nginx]$ sudo systemctl status nginx
● nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2020-07-15 12:24:24 EDT; 5min ago
Process: 464694 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
Process: 464695 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
Process: 464696 ExecStart=/usr/sbin/nginx (code=exited, status=1/FAILURE)
CPU: 33ms
Jul 15 12:24:22 MiWiFi-R4CM-srv nginx[464696]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Jul 15 12:24:22 MiWiFi-R4CM-srv nginx[464696]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Jul 15 12:24:23 MiWiFi-R4CM-srv nginx[464696]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Jul 15 12:24:23 MiWiFi-R4CM-srv nginx[464696]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Jul 15 12:24:23 MiWiFi-R4CM-srv nginx[464696]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Jul 15 12:24:23 MiWiFi-R4CM-srv nginx[464696]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Jul 15 12:24:24 MiWiFi-R4CM-srv nginx[464696]: nginx: [emerg] still could not bind()
Jul 15 12:24:24 MiWiFi-R4CM-srv systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Jul 15 12:24:24 MiWiFi-R4CM-srv systemd[1]: nginx.service: Failed with result 'exit-code'.
Jul 15 12:24:24 MiWiFi-R4CM-srv systemd[1]: Failed to start The nginx HTTP and reverse proxy server.