1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Nginx not starting: Address already in use (nginx: bind to 0.0.0.0:80 failed)

Posted at

概要

ローカルでnginxを起動しようとするとタイトルエラーになったので解決方法をメモ

結論

apacheがすでに起動しており、80番portを使っていたため

$ sudo nginx
nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use)
nginx: [emerg] still could not bind()

80番portを使用しているプロセスを確認してみると、httpd(apache)を発見

$ sudo lsof -i:80
httpd    77 root    4u  IPv6 0xd09cf808e840caf7      0t0  TCP *:http (LISTEN)
httpd   253 _www    4u  IPv6 0xd09cf808e840caf7      0t0  TCP *:http (LISTEN)
httpd   638 _www    4u  IPv6 0xd09cf808e840caf7      0t0  TCP *:http (LISTEN)
httpd   671 _www    4u  IPv6 0xd09cf808e840caf7      0t0  TCP *:http (LISTE

やったこと

apacheのstop

sudo apachectl stop

nginxを起動

sudo nginx

念の為、起動できているか確認

ps -ef | grep nginx
    0 24549     1   0 11:33AM ??         0:00.00 nginx: master process nginx
   -2 24550 24549   0 11:33AM ??         0:00.00 nginx: worker process

無事起動できました!

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?