Apache 2.4 环境变量被忽略

Apache 2.4 环境变量被忽略

我将服务器从 Debian 7 升级到了 Debian 8。结果,我遇到了 Apache 2.4.10 的多个问题

执行时:

apache2 -S

结果:

AH00111: Config variable ${APACHE_LOCK_DIR} is not defined
AH00111: Config variable ${APACHE_PID_FILE} is not defined
AH00111: Config variable ${APACHE_RUN_USER} is not defined
AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
AH00111: Config variable ${APACHE_LOG_DIR} is not defined
AH00526: Syntax error on line 74 of /etc/apache2/apache2.conf:
Invalid Mutex directory in argument file:${APACHE_LOCK_DIR}

环境变量的内容

export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data

export APACHE_PID_FILE=/var/run/apache2/apache2$SUFFIX.pid
export APACHE_RUN_DIR=/var/run/apache2$SUFFIX
export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX

export APACHE_LOG_DIR=/var/log/apache2$SUFFIX

这是默认设置,所以我不知道为什么它不起作用。

到目前为止,我只找到了相互矛盾的解决方案,顺便说一句,这些解决方案都没有帮助,或者我没有理解。

然而,Apache 正在运行,但显然会发送大量错误日志。我非常困惑,我很高兴因为问了这么愚蠢的问题而被否决。

答案1

你使用不apache2正确,请参阅手册页

In  general, apache2 should not be invoked directly, but rather should 
be invoked via /etc/init.d/apache2 or apache2ctl. The default Debian 
configuration requires environment variables that are defined in 
/etc/apache2/envvars  and  are  not  available  if  apache2  is  
started  directly. However, apache2ctl can be used to pass arbitrary 
arguments to apache2.

相关内容