The main error is:
AH00111: Config variable ${APACHE_RUN_DIR} is not defined
You should try to run apache via the /etc/init.d/apache2
start/stop script, not the binary directly. The script should export all environment variables needed, from /etc/apache2/envvars
.
Try:
# service apache2 restart
See the explanation here:
https://serverfault.com/questions/558283/apache2-config-variable-is-not-defined
I can reproduce your error:
root@efk:~# service apache2 stop
root@efk:~# /usr/sbin/apache2 --version
[Thu Mar 14 20:54:17.111349 2019] [core:warn] [pid 28733]
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
root@efk:~# service apache2 start
root@efk:~# apachectl --status
httpd (pid 28782) already running
root@efk:~# service apache2 stop
root@efk:~# /etc/init.d/apache2 start
[ ok ] Starting apache2 (via systemctl): apache2.service.
root@efk:~# apachectl --status
httpd (pid 28966) already running
So, it is evident that the apache2
must be called through init script and not by directly calling the binary. Now by calling init script I can confirm that it works either way, /etc/init.d/apache2 start
or service apache2 start
. Both start the daemon via the systemctl
command.
/etc/apache2/apache2.conf
? Try runningvim +80 /etc/apache2/apache2.conf
and it should open the offending config line ...DefaultRuntimeDir ${APACHE_RUN_DIR}
?/etc/apache2/envvars
file contains the lineexport APACHE_RUN_DIR=/var/run/apache2$SUFFIX
.DefaultRuntimeDir ${APACHE_RUN_DIR}
. As to your 2nd comment this is line 20:export APACHE_RUN_DIR=/var/run/apache2$SUFFIX
apache2
binary directly doesn't set nor export environment variables from/etc/apache2/envvars
. I don't now which versions it started to be obligatory to start/etc/init.d/apache2 start
orservice apache2 start
, but now it is a must.