Apache再起動時に出るメッセージの件

Apache再起動時に以下のメッセージが出る場合の対処法。

$ sudo /etc/init.d/apache2 restart
 * Restarting web server apache2
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName  [ OK ]

/etc/hosts の 127.0.0.1 の行を以下のようにlocalhost.localdomain を先頭に持ってくることで対処できる。

$ sudo vi /etc/hosts
127.0.0.1         localhost.localdomain localhost haruhi

上記を編集後にApache を再起動するとエラーは出なくなっている。

$ sudo /etc/init.d/apache2 restart
 * Restarting web server apache2      [ OK ]