Ubuntu EC2 上的 Apache2 无法读取环境变量

Ubuntu EC2 上的 Apache2 无法读取环境变量

我的 EC2 实例上的 Apache2 出现了小问题。我安装了 LAMP,但当我调用时,apache2我收到了以下信息:

[Thu Dec 03 22:06:56.100599 2015] [core:warn] [pid 31235] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined
[Thu Dec 03 22:06:56.100721 2015] [core:warn] [pid 31235] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Thu Dec 03 22:06:56.100777 2015] [core:warn] [pid 31235] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Thu Dec 03 22:06:56.100824 2015] [core:warn] [pid 31235] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Thu Dec 03 22:06:56.100871 2015] [core:warn] [pid 31235] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Thu Dec 03 22:06:56.105835 2015] [core:warn] [pid 31235] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Thu Dec 03 22:06:56.105971 2015] [core:warn] [pid 31235] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Thu Dec 03 22:06:56.106008 2015] [core:warn] [pid 31235] 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}

我尝试了所有方法 -apt-get update再次安装 LAMP,但没有任何效果。我该如何设置此配置变量?

是的,我尝试在互联网上寻找解决方案,但是找不到。

答案1

直接从二进制文件调用 Apache 不包含环境变量,这会导致抛出错误。

使用 init 脚本启动、重启和停止 Apache,方法是

$ sudo service apache2 restart

或者

$ sudo apachectl restart

相关内容