RaspiOS Apache2のAH00558エラー対処方法

「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」というエラーが出るので、その対処法です。

対処方法

「local-servername.conf」ファイルを作成して、その中に「ServerName」ディレクティブを設定します。

$ sudo systemctl status apache2 <= エラーメッセージが出力されていることの確認
● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2020-08-14 01:46:01 JST; 8s ago
     Docs: https://httpd.apache.org/docs/2.4/
  Process: 22723 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
 Main PID: 22727 (apache2)
    Tasks: 6 (limit: 2187)
   CGroup: /system.slice/apache2.service
           ├22727 /usr/sbin/apache2 -k start
           ├22731 /usr/sbin/apache2 -k start
           ├22732 /usr/sbin/apache2 -k start
           ├22733 /usr/sbin/apache2 -k start
           ├22734 /usr/sbin/apache2 -k start
           └22735 /usr/sbin/apache2 -k start

Aug 14 01:46:01 raspberry systemd[1]: Starting The Apache HTTP Server...
Aug 14 01:46:01 raspberry apachectl[22723]: 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 <= 起動時にエラー出力
Aug 14 01:46:01 raspberry systemd[1]: Started The Apache HTTP Server.
$ cd /etc/apache2/.
$ sudo echo "ServerName localhost" > conf-available/local-servername.conf <= 定義作成
$ sudo systemctl stop apache2
$ sudo systemctl start apache2
$ sudo systemctl status apache2 <= エラーメッセージが出力されていないことの確認
● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2020-08-14 01:53:46 JST; 3s ago
     Docs: https://httpd.apache.org/docs/2.4/
  Process: 22843 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
 Main PID: 22847 (apache2)
    Tasks: 6 (limit: 2187)
   CGroup: /system.slice/apache2.service
           ├22847 /usr/sbin/apache2 -k start
           ├22851 /usr/sbin/apache2 -k start
           ├22852 /usr/sbin/apache2 -k start
           ├22853 /usr/sbin/apache2 -k start
           ├22854 /usr/sbin/apache2 -k start
           └22855 /usr/sbin/apache2 -k start

Aug 14 01:53:45 raspberry systemd[1]: Starting The Apache HTTP Server...
Aug 14 01:53:46 raspberry systemd[1]: Started The Apache HTTP Server.

参考にした情報

メッセージは出力されますが、無視をしても良いようです。

$ cd /usr/share/doc/apache2/.
$ sudo gunzip README.Debian.gz
$ cat README.Debian <= ここに書いてある
   : (割愛)
Common Problems
===============

1) Error message "Could not reliably determine the server's fully qualified
domain name, using 127.0.0.1 for ServerName" during start

This can usually be ignored but it means that Apache httpd was unable to obtain
a fully-qualified hostname by doing a reverse lookup on your server's IP
address. You may want to add the fully-qualified hostname to '/etc/hosts'.
An alternative is to specify "ServerName 127.0.0.1" in the global server
context of the configuration, e.g. in
'/etc/apache2/conf-enabled/local-servername.conf'.

----- 適当翻訳(ここから) -----
1) エラーメッセージ "Could not reliably determine the server's fully qualified
domain name, using 127.0.0.1 for ServerName" がスタート時に出力される。

通常、これは無視できるが、Apache httpdがサーバーのIPアドレスを逆引きして
完全修飾ホスト名を取得できなかったことを意味する。完全修飾ホスト名を'/etc/hosts'に
追加することができる。 代わりに、構成のグローバルサーバーコンテキストで
"ServerName 127.0.0.1"を指定することもできる。 
'/etc/apache2/conf-enabled/local-servername.conf'
----- 適当翻訳(ここまで) -----

2) Error message "mod_rewrite: could not create rewrite_log_lock"

This probably means that there are some stale SYSV semaphores around. This
usually happens after apache2 has been killed with kill -9 (SIGKILL). You can
clean up the semaphores with:

        ipcs -s | grep www-data | awk ' { print $2 } ' | xargs ipcrm sem

3) Message "File does not exist: /etc/apache2/htdocs" in error log

In most cases this means that no matching VirtualHost definition could be
found for an incoming request. Check that the target IP address/port and the
name in the Host: header of the request actually match one of the virtual
hosts.

4) Message "Couldn't create pollset in child; check user or system limits" in
  error log

On Linux kernels since 2.6.27.8, the value in

    /proc/sys/fs/epoll/max_user_instances

needs to be larger than

    for prefork/itk  MPM: 2 * MaxClients
    for worker/event MPM: MaxClients + MaxClients/ThreadsPerChild

It can be set on boot by adding a line like

        fs.epoll.max_user_instances=1024

to '/etc/sysctl.conf'.

There are several other error messages related to creating a pollset that can
appear for the same reason.

On the other hand, errors about adding to a pollset are related to the setting
fs.epoll.max_user_watches. On most systems, max_user_watches should be high
enough by default.

5) Message "Server should be SSL-aware but has no certificate configured" in
   error log

Since 2.2.12, Apache is stricter about certain misconfigurations concerning
name based SSL virtual hosts. See NEWS.Debian.gz for more details.

6) Apache does not pass Authorization header to CGI scripts

This is intentional to avoid security holes. If you really want to change it,
you can use mod_rewrite:

        RewriteCond %{HTTP:Authorization} (.*)
        RewriteRule . - [env=HTTP_AUTHORIZATION:%1]

7) mod_dav is behaving strangely

In general, if you use mod_dav_fs, you need to disable multiviews and script
execution for that directory. For example:

    
        Dav on
        Options -MultiViews -ExecCGI
        SetHandler none
        
            php_admin_value engine Off
       
   

8) Message "apache2: bad user name ${APACHE_RUN_USER}" when starting apache2
   directly

Use apache2ctl (it accepts all the same options as apache2).

9) A PUT with mod_dav_fs fails with "Unable to PUT new contents for /...
[403, #0]" even if Apache has permission to write the file.

Apache also needs write permission to the directory containing the file, in
order to replace it atomically.

10) When starting/reloading Apache, there is the error message
    "ulimit: open files: cannot modify limit: Operation not permitted"

If you are running Apache in a vserver environment, the start script may not
be allowed to set the maximum number of open files. You should adjust
APACHE_ULIMIT_MAX_FILES in /etc/apache2/envvars to your setup. You can
disable changing the limits by setting APACHE_ULIMIT_MAX_FILES=true .
   : (割愛)
タイトルとURLをコピーしました