はじめに
apache2ctl configtestを実行すると、
AH00558: apache2:
Could not reliably determine the server's fully qualified domain name,
が出ていたが、解決した。
最終更新日
2022年8月1日
環境の情報
OS
Ubuntu20.04
注意
最新の状態を確認して下さい。
公式さまはこちら
https://www.apache.org/
https://httpd.apache.org/docs/2.4/programs/apachectl.html
参考さまはこちら
https://www.kishiro.com/apache/config_syntax_check.html
https://mk-55.hatenablog.com/entry/2014/07/07/004510
https://www.yokoweb.net/2020/08/14/ubuntu-20_04-apache-php/
状況
文法チェックすると、エラーが出た。
/etc/apache2/sites-available$ sudo apache2ctl configtest
AH00558: apache2:
Could not reliably determine the server's fully qualified domain name,
using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Syntax OK
意味
公式から
configtestの意味
Run a configuration file syntax test.
It parses the configuration files and either reports Syntax Ok or detailed information about the particular syntax error.
This is equivalent to apachectl -t.
設定ファイルの構文のテストをします。
やったこと
移動する。
/etc/apache2/sites-available$ cd /etc/apache2/conf-available/
設定ファイルが何があるか確認する。
/etc/apache2/conf-available$ ls
charset.conf other-vhosts-access-log.conf serve-cgi-bin.conf
javascript-common.conf php7.4-fpm.conf
localized-error-pages.conf security.conf
fqdn.confを作る。
/etc/apache2/conf-available$ sudo vi fqdn.conf
fqdn.confの内容をこんな感じで作る。
/etc/apache2/conf-available$ cat fqdn.conf
ServerName 127.0.1.1
fqdnを有効化する。
/etc/apache2/conf-available$ sudo a2enconf fqdn
Enabling conf fqdn.
To activate the new configuration, you need to run:
systemctl reload apache2
Apache2を再びスタートさせる。
/etc/apache2/conf-available$ sudo service apache2 restart
そして
再び、configtestを実行する。
エラーは無くなった!やったね!
/etc/apache2/conf-available$ sudo apache2ctl configtest
Syntax OK