Apache を再起動すると、「httpd: Could not reliably determine the server’s fully qualified domain name, using XXXXXXXXXXXXX for ServerName」と出力される

こんにちはKUJIRAです。Apacheをインストールして再起動をかけたら以下のようなメッセージが出力されたので原因と解決方法をメモとして残します。

# service httpd restart
httpd を停止中 [ OK ]
httpd を起動中 [ OK ]
httpd: Could not reliably determine the server's fully qualified domain name, using kujira.sandbox.local.com for ServerName

原因
原因は「/etc/httpd/conf/httpd.conf」内にサーバネームが記述されていないことがこのメッセージが出力される要因になっています。そのため Apache の設定ファイルである「/etc/httpd/conf/httpd.conf」の書き換えが必要です。

# vi /etc/httpd/conf/httpd.conf

 ・
 ・
 ・

#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed.  This address appears on some server-generated pages, such
# as error documents.  e.g. admin@your-domain.com
#
ServerAdmin root@localhost

#
# 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 this is not set to valid DNS name for your host, server-generated
# redirections will not work.  See also the UseCanonicalName directive.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
# You will have to access it by its address anyway, and this will make 
# redirections work in a sensible way.
#
#ServerName www.example.com:80   <= ここの部分を編集

#
# UseCanonicalName: Determines how Apache constructs self-referencing 
# URLs and the SERVER_NAME and SERVER_PORT variables.
# When set "Off", Apache will use the Hostname and Port supplied
# by the client.  When set "On", Apache will use the value of the
# ServerName directive.
#
UseCanonicalName Off


 ・
 ・
 ・

viで設定ファイルを開いたら、編集対象箇所を編集します。

編集前
#ServerName www.example.com:80

編集後
ServerName www.example.com:80

「www.example.com」の箇所にはapacheのサーバーのホスト名を入れてください。例えば公開するホームページのURLが「http://www.test.com/」だとするとホスト名は「www.test.com」になります。

編集が終わったら設定ファイルの書式が間違っていないかを確認します。

# service httpd configtest
Syntax OK

「Syntax OK」と表示されたら正しく設定ファイルが記述されているので設定を読み込みましょう。

#service  httpd reload

以上で解決です。

ということで今日はここまでKUJIRAでした。

Apache を再起動すると、「httpd: Could not reliably determine the server’s fully qualified domain name, using XXXXXXXXXXXXX for ServerName」と出力される” への1件のフィードバック

コメントを残す

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください