Help us understand the problem. What is going on with this article?

他プロセスがポートを占有してhttpdを再起動できない

More than 5 years have passed since last update.

現象

httpdを再起動しようとすると、Address already in useと言われ再起動できない。

$ sudo /etc/init.d/httpd restart
httpd を停止                                               [  OK  ]
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
Unable to open logs
                                                           [失敗]

環境

$ httpd -v
Server version: Apache/2.2.29 (Unix)
Server built:   Mar 12 2015 03:50:17

原因

httpdが異常終了する等して古いhttpdプロセスが残っていることが原因。

対策

lsofコマンドで古いプロセスを表示し、killすればよい。

$ sudo lsof -i | grep http
httpd    27512   apache    4u  IPv6  90360      0t0  TCP *:http (LISTEN)
httpd    27520   apache    4u  IPv6  90360      0t0  TCP *:http (LISTEN)

27512, 27520のidをもつプロセスが残っていることが分かる。

$ sudo kill -9 27512
$ sudo kill -9 27520

これで起動するようになる。

$ sudo /etc/init.d/httpd restart
httpd を停止中:                                            [  OK  ]
httpd を起動中:                                            [  OK  ]
ysk24ok
今後Qiitaに記事を更新することはありません。
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした