1
1

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 5 years have passed since last update.

macOS MojaveでApacheを起動しようとしたらAddress already in use: AH00072: make_sock: could not bind to addressとなったときの対応方法

Last updated at Posted at 2018-12-14

事象 : Apacheを起動しようとしたら怒られた

$ apachectl start
(48)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(48)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs

原因 : ポートが他のアプリとかぶっているから

$ lsof -i | grep 80
Google      731 mana  180u  IPv4 0x1dd0702206feb65      0t0  TCP 192.168.0.4:50545->185.199.110.153:https (ESTABLISHED)
Google      731 mana  280u  IPv4 0x1dd07021f59ab65      0t0  TCP 192.168.0.4:50585->104.17.69.176:https (ESTABLISHED)
Dropbox   61354 mana  150u  IPv4 0x1dd07021784d4e5      0t0  TCP 192.168.43.220:63686->162.125.80.3:https (CLOSE_WAIT)
Dropbox   61354 mana  203u  IPv4 0x1dd07020b6521e5      0t0  TCP 192.168.0.4:50211->162.125.80.3:https (CLOSE_WAIT)
Dropbox   61354 mana  205u  IPv4 0x1dd070221fad7e5      0t0  TCP 192.168.0.4:50212->162.125.80.7:https (CLOSE_WAIT)

Apacheで使うポート番号を変える

$ vi /usr/local/etc/httpd/httpd.conf
#<省略>
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 8080 #<<< 80番から8080に変更した
#<省略>

# エラーは残っているけどポートの被りは解決
$ apachectl start
(13)Permission denied: AH00091: httpd: could not open error log file /usr/local/var/log/httpd/error_log.
AH00015: Unable to open logs
1
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?