MXLinux19でAH00558: apache2: 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の対応
昔、自分が低スペックPCに軽量Debian系ディストリをインストールして
LAMPサーバを立ててバーチャルホストで運用する記事を書いた時の
手順を実行した時にタイトルのエラーが発生したので、やった内容
を備忘録としてまとめる(Φω|
ここでは、例としてバーチャルホストはexample.comとする。
ちなみに手順は、13を実行しようとしてエラーが発生。
[解決策]
1. /etc/apache2/conf-available 以下を確認すると、fqdn.confがないので
バーチャルホストのURLを指定して作成。
$ echo "ServerName example.com" | sudo tee /etc/apache2/conf-available/fqdn.conf
2. a2enconf で文法エラーがないか確認。
$ sudo a2enconf fqdn
3. 2を実行後、下記メッセージが出力されたので指示に従い実行。
Enabling conf fqdn.
To activate the new configuration, you need to run:
service apache2 reload
4. 名前解決のため、/etc/hosts にもバーチャルホスト名を追記。
$ sudo vim /etc/hosts
5. apache2を再読み込み、再起動。
$ sudo service apache2 reload
$ sudo service apache2 stop
$ sudo service apache2 start
※もちろん、restartコマンドでも可。
6. ブラウザを再起動し、下記URLでphpinfo()の内容が表示されれば
OK。
[参考サイト]
apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1whiscardz.wordpress.com