0

Apacheを再起動したら下記のようなエラーが出ます。

# sudo /etc/init.d/httpd restart                                                                                   
httpd を停止中:                                            [失敗]
httpd を起動中: httpd: Could not reliably determine the server's fully qualified  domain name, using localhost.localdomain for ServerName

調べたところ、以下のサイトに解決法があり、それを参考に、
/etc/httpd/conf/httpd.confに、ServerName localhost.localdomain:80を記載してみました。
http://qiita.com/pugiemonn/items/41d4bebf48437eed3f4c
↓内容。

#
# 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 localhost.localdomain:80   

しかし、結果は、

# sudo /etc/init.d/httpd restart
httpd を停止中:                                            [失敗]
httpd を起動中:                                            [失敗]

となり、エラーメッセージさえ出ず、失敗となります。

何がいけないのでしょうか?どうすれば再起動できるようになるでしょうか?

よろしくお願いいたします。

追記:
エラーログ​/var/log/httpd以下のエラーログを確認したところ
最後に

 [Mon Jul 25 11:16:01 2016] [notice] SIGHUP received.  Attempting to restart
 httpd: Could not reliably determine the server's fully qualified domain name,     using localhost.localdomain for ServerName

というエラーが出ていました。
以下のサイトを参考に、/etc/logrotate.d/httpd

 postrotate
 sbin/service httpd reload > /dev/null 2>/dev/null || true
 endscript

をコメントアウトして、

 weekly
 rotate 4
 copytruncate

を追記してみましたが、やはりダメでした。
http://every-rating.com/vps/httpderror-logsighup-received-attempting-to-restart.html

10
  • httpd -t で書式チェックをしてみてください。 2016年7月28日 5:07
  • ご回答ありがとうございます。 # httpd -t Syntax OK 書式は問題ないようです。
    – KY6
    2016年7月28日 5:13
  • Qiitaにも書かれていますが、ServerNameに関するメッセージが出ていてもApacheは動作するので、起動できないことと直接の関係はないと思います。/var/log/httpd//var/log/apache2/ にエラーログがあると思うので、そこを確認してみてください。(エラーログの内容を貼り付ける場合は質問を編集してくださいね)
    – unarist
    2016年7月28日 5:21
  • 停止で失敗しています。httpdが稼働しているのに、多重に起動しようとすれば失敗するのは当然です。 まず、su /etc/init.d/httpd stopで、停止させてみてください。コマンドで停止できないなら、httpdのプロセスをkillしてから、su /etc/init.d/httpd startで起動させてみてください。
    – Fumu 7
    2016年7月28日 5:47
  • – Fumu 7さん ご回答ありがとございます。stopしてもダメでした。そもそも起動していないようです。
    – KY6
    2016年7月28日 6:23

0

この質問に回答するには、ログインする必要があります。

のタグが付いた他の質問を参照する。