macos上においてapacheを起動するとエラーが発生する問題

拝啓、今日はいっぱい更新です。
macos Sierreの更新で設定が初期化したのでいろいろ変更が発生してます。
ともあれ、小っちゃい問題をあとあと覚え書き程度になるかなと思いながら書いております。
今回の問題は開発作業に入ったときに発覚しました
ソースを変更して叩くとブラウザにてサーバが見つかりません!

サーバを再起動させてみました。

$ sudo httpd -k restart
AH00557: httpd: apr_sockaddr_info_get() failed for MacBookAir.local
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message

なんだか不明なエラーが発生している
「httpd: apr_sockaddr_info_get() failed for」で検索を行ってみた。
http://futuremix.org/2007/09/httpd-apr_sockaddr_info_get-failed
” 原因は /etc/sysconfig/network に書いてある HOSTNAME が見つからないこと”ってあるな。
確認すると、”MacBookAir.local”の記述が無かったので追記する。

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 MacBookAir.local

apacheを再起動…

$ sudo httpd -k restart
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message

はい、”ServerName”があれってことだね。

環境設定を変更する。
ServerNameの記述がコメントアウトのみなのでlocalhostに修正

$ sudo vi /etc/apache2/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:80
ServerName localhost

#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
...

ServerName localhost を追加

$ sudo httpd -k restart

はい、出なくなりました。Happy
phpとかがさっぱり新品になっていたので

$ sudo vi /etc/apache2/httpd.conf

LoadModule php5_module libexec/apache2/libphp5.so
コードを外す

$ sudo vi /etc/apache2/other/php5.conf 

AddType application/x-httpd-php .php .json
.phpに.jsonを追加

これで開発に戻れます


コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です