LoginSignup
4
5

More than 5 years have passed since last update.

macOS MojaveでApacheを起動しようとしたらCould not reliably determine the server's fully qualified domain name, using IPアドレス. Set the 'ServerName' directive globally to suppress this messageとなったときの対応方法

Last updated at Posted at 2018-12-14

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

$ apachectl start
AH00558: httpd: Could not reliably determine the server`s fully qualified domain name, using {IPアドレス}. Set the 'ServerName' directive globally to suppress this message
(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

$ apachectl configtest
AH00558: httpd: Could not reliably determine the server`s fully qualified domain name, using mananoMacBookAir.local. Set the 'ServerName' directive globally to suppress this message
Syntax OK

原因 : httpd.confでServerNameを指定していないから

ServerName が指定されていないときは、 サーバは IP アドレスから逆引きを行なうことでホスト名を知ろうとします。 ServerName にポートが指定されていないときは、 サーバはリクエストが来ている ポートを使います。最高の信頼性と確実性をもたらすためには、 ServerName を使ってホスト名とポートを明示的に 指定してください。
core - Apache HTTP サーバ バージョン 2.4

macOS MojaveにHomebrewでApacheをインストールしてから何も設定はしていなかった。

対応 : httpd.confでServerNameを指定する

$ vi /usr/local/etc/httpd/httpd.conf
#<省略>
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:8080
ServerName localhost:8080 #<<<ここを追記
#<省略>

$ apachectl configtest
Syntax OK

# まだポート番号のかぶりとかエラーは残るけどServerNameのエラーは解決
$ 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

参考

4
5
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
4
5