apache を起動したら、/var/log/httpd/error_log に apr_sockaddr_info_get() failed for というエラーが出力されていた。ps コマンドで httpd のプロセスを確認したらちゃんと起動しているし、動作も問題ないようだ。まあほっといても良さそうだけど、一応調べてみた。
# systemctl restart httpd
プロセス確認。
# ps aux|grep httpd root 6901 0.0 0.0 315932 12360 ? Ss 15:28 0:00 /usr/sbin/httpd -DFOREGROUND apache 6902 0.0 0.0 315932 6228 ? S 15:28 0:00 /usr/sbin/httpd -DFOREGROUND apache 6903 0.0 0.0 315932 6228 ? S 15:28 0:00 /usr/sbin/httpd -DFOREGROUND apache 6904 0.0 0.0 315932 6228 ? S 15:28 0:00 /usr/sbin/httpd -DFOREGROUND apache 6905 0.0 0.0 315932 6228 ? S 15:28 0:00 /usr/sbin/httpd -DFOREGROUND apache 6906 0.0 0.0 315932 6228 ? S 15:28 0:00 /usr/sbin/httpd -DFOREGROUND root 10226 0.0 0.0 112724 980 pts/0 S+ 16:10 0:00 grep --color=auto httpd
出力されたエラーログ
/var/log/httpd/error_log
[Mon Aug 13 15:27:55.263193 2018] [mpm_prefork:notice] [pid 6808] AH00163: Apache/2.4.6 (CentOS) PHP/5.4.16 configured -- resuming normal operations [Mon Aug 13 15:27:55.263212 2018] [core:notice] [pid 6808] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND' [Mon Aug 13 15:28:18.772211 2018] [mpm_prefork:notice] [pid 6808] AH00170: caught SIGWINCH, shutting down gracefully [Mon Aug 13 15:28:19.818079 2018] [suexec:notice] [pid 6901] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec) AH00557: httpd: apr_sockaddr_info_get() failed for servername 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.conf に servername が設定されてないので、とりあえずサーバ名を 127.0.0.1 としますよというメッセージらしい。ということで、httpd.conf の 90行目あたりの ServerName に hostname コマンドで出力されたホスト名を記述してあげたら上記メッセージは表示されなくなった。
ServerName servername:80