📝
使用しているポートのプロセスを調べる方法
だれ?ポート使っているのは?
って思うときありますよね。そんなときは lsof
コマンド。実は、Apache が起動しなくて何かしたっけ?と30分位はまったのでいつもの自分メモ。
あれ?怒られるw
Apache がなにをやっても起動しなく出ていたログ。誰か(プロセス)がすでにポートを使用しているという風に怒られ Apache が起動できません。
command
# /etc/init.d/httpd start
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
(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
[FAILED]
おまえか!!
と、lsof
コマンドを実行してみる。どうやら nginx が起動していたでござるった。
そりゃ Address already in use
と怒られますね。
command
$ lsof -i | grep http
nginx 2945 root 7u IPv4 15378 0t0 TCP *:http (LISTEN)
nginx 2946 git 7u IPv4 15378 0t0 TCP *:http (LISTEN)
Discussion