Mind Dump, Tech And Life Blog
written by Ivan Alenko
published under license CC4-BY
posted in category Systems Software / Nginx & Apache
posted at 27. May '24

Use apachectl instead of apache2

To check the Apache configuration, -t switch is used. However with apache2 binary/command, it is no good as it throws a false positive syntax error. Apparently apachectl -t command has to be used, because it is a modern replacement. Yet both binaries/commands are present in the operating system.

root@starz:/etc/apache2/sites-enabled# apache2 -t
[Sun May 12 17:34:34.389076 2024] [core:warn] [pid 426124] AH00111: Config variable ${APACHE_RUN_DIR} is not defined
apache2: Syntax error on line 80 of /etc/apache2/apache2.conf: DefaultRuntimeDir must be a valid directory, absolute or relative to ServerRoot
The Apache error log may have more information.
root@starz:/etc/apache2/sites-enabled# apachectl -t
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message
Syntax OK

With apachectl I got only a warning which is fine. It is a very sane action to check configuration before server restart or reload.

Add Comment