nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
みたいな・・・
これはサービスとしてではなく実行されている?
# lsof -i:80 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME nginx 132964 root 7u IPv4 411662 0t0 TCP *:http (LISTEN) nginx 132964 root 9u IPv6 411664 0t0 TCP *:http (LISTEN) nginx 132969 nginx 7u IPv4 411662 0t0 TCP *:http (LISTEN) nginx 132969 nginx 9u IPv6 411664 0t0 TCP *:http (LISTEN) # ps ax|grep nginx 132964 ? Ss 0:00 nginx: master process nginx -c /etc/nginx/nginx.conf 132969 ? S 0:00 nginx: worker process 132970 ? S 0:00 nginx: cache manager process
これで実行すると
# systemctl status nginx
● nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
Drop-In: /usr/lib/systemd/system/nginx.service.d
└─php-fpm.conf
Active: active (running) since Thu 2022-09-01 14:06:15 EDT; 7s ago
Process: 133461 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
Process: 133462 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
Process: 133463 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
Main PID: 133464 (nginx)
Tasks: 4 (limit: 4455)
Memory: 3.5M
CPU: 41ms
CGroup: /system.slice/nginx.service
├─133464 "nginx: master process /usr/sbin/nginx"
├─133465 "nginx: worker process"
├─133466 "nginx: cache manager process"
└─133467 "nginx: cache loader process"
9月 01 14:06:15 i-14100000403049 systemd[1]: Starting The nginx HTTP and reverse proxy server...
9月 01 14:06:15 i-14100000403049 nginx[133462]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
9月 01 14:06:15 i-14100000403049 nginx[133462]: nginx: configuration file /etc/nginx/nginx.conf test is successful
9月 01 14:06:15 i-14100000403049 systemd[1]: Started The nginx HTTP and reverse proxy server.正常
#systemctl start nginx
で大丈夫で
#systemctl stop nginx
で
#lsof -i:80
#ps ax|grep nginx
もプロセスは消えました。



コメント