httpdを再起動しようとすると、「Address already in use」
と言われ再起動できないときがあるのでこの記事を残そうと思う
環境は
- Apache2.4.18
- CentOS7.2
現象
他プロセスがポートを占有してhttpdを起動や再起動ができないときがある
1 2 3 |
httpd を起動中: (98)Address already in use: make_sock: could not bind to address [::]:80 (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down |
これわ困ったーーー
対処法
httpdの古いプロセスが残ってる場合があるので以下のコマンドを打ってやる
1 |
lsof -i | grep http |
ずらーっとプロセスがでてくるので「kill -9」で強制的にkillしてやる
1 |
kill -9 ここにPID |
これで起動するようになる
1 |
/usr/local/apache2/bin/apachectl restart |