0
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 Catalina(10.15.3)で、Homebrewで入れたApacheが起動しない問題への対応

Posted at

現象

macOS Catalinaを10.15.3にアップデートしたら、Homebrewで入れたApacheが起動しなくなった。

# ブラウザでlocahostにアクセスしても何も表示されない
$ sudo apachectl start

調査

Apacheのログを調べてみる。

Apacheのログファイルの場所

Apacheのログファイルの場所は、httpd.confに書かれている。ApacheはHomebrewで入れたので、パスは/usr/local/etc/httpd/httpd.confになる。

$ view /usr/local/etc/httpd/httpd.conf
...
ErrorLog "/usr/local/var/log/httpd/error_log"
...

ログを見る

$ tail -1000 /usr/local/var/log/httpd/error_log
...
[Wed Feb 05 22:33:14.400907 2020] [ssl:warn] [pid 20851] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Wed Feb 05 22:33:14.401430 2020] [cgid:error] [pid 20852] (2)No such file or directory: AH01243: Couldn't bind unix domain socket /usr/local/var/run/httpd/cgisock.20851
[Wed Feb 05 22:33:14.402081 2020] [http2:warn] [pid 20851] AH10034: The mpm module (prefork.c) is not supported by mod_http2. The mpm determines how things are processed in your server. HTTP/2 has more demands in this regard and the currently selected mpm will just not do. This is an advisory warning. Your server will continue to work, but the HTTP/2 protocol will be inactive.
[Wed Feb 05 22:33:14.402221 2020] [lbmethod_heartbeat:notice] [pid 20851] AH02282: No slotmem from mod_heartmonitor
[Wed Feb 05 22:33:14.403549 2020] [core:error] [pid 20851] (2)No such file or directory: AH00099: could not create /usr/local/var/run/httpd/httpd.pid
[Wed Feb 05 22:33:14.403572 2020] [core:error] [pid 20851] AH00100: httpd: could not log pid to file /usr/local/var/run/httpd/httpd.pid

解決策

ログを見る限り、/usr/local/var/run/httpd/httpd.pidが作られないようだ。ディレクトリを確認すると、httpdディレクトリがなかった。httpdディレクトリを手動で作ると動くようになった。

# runディレクトリ以下には何もない
$ cd /usr/local/var/run
$ ls -la 
total 0
drwxr-xr-x  2 username  admin   64  2  5 22:33 .
drwxrwxr-x  9 username  admin  288  2  5 22:33 ..

# httpdディレクトリを作成
$ mkdir httpd
$ ls -la
total 0
drwxr-xr-x  3 username  admin   96  2  5 22:35 .
drwxrwxr-x  9 username  admin  288  2  5 22:33 ..
drwxr-xr-x  2 username  admin   64  2  5 22:35 httpd

# ブラウザでlocalhostにアクセスできるようになった!
$ sudo apachectl start

# cgisock.21666 と httpd.pidが作成されている
$ ls -la /usr/local/var/run/httpd
total 8
drwxr-xr-x  4 username  admin  128  2  5 22:35 .
drwxr-xr-x  3 username  admin   96  2  5 22:35 ..
srwx------  1 _www      admin    0  2  5 22:35 cgisock.21666
-rw-r--r--  1 root      admin    6  2  5 22:35 httpd.pid
0
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
0
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?