我一直在 Ubuntu 16.04 上使用 Apache 2.4.18 设置博客/云服务器,重新启动机器后,出现了这个错误。
[Wed Aug 03 01:04:41.468928 2016] [core:warn] [pid 3191] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined
[Wed Aug 03 01:04:41.468964 2016] [core:warn] [pid 3191] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Wed Aug 03 01:04:41.468976 2016] [core:warn] [pid 3191] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Wed Aug 03 01:04:41.468979 2016] [core:warn] [pid 3191] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Wed Aug 03 01:04:41.468987 2016] [core:warn] [pid 3191] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Wed Aug 03 01:04:41.507710 2016] [core:warn] [pid 3191] AH00111: Config variable ${APACHE_RUN_DIR} is not defined
[Wed Aug 03 01:04:41.507998 2016] [core:warn] [pid 3191] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Wed Aug 03 01:04:41.508128 2016] [core:warn] [pid 3191] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Wed Aug 03 01:04:41.508138 2016] [core:warn] [pid 3191] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Wed Aug 03 01:04:41.508284 2016] [core:warn] [pid 3191] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Wed Aug 03 01:04:41.508292 2016] [core:warn] [pid 3191] 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}
/etc/apache2/apache.conf 第 74 行:
Mutex file:${APACHE_LOCK_DIR} default
除了重新安装 Apache 之外,解决这个问题最简单的方法是什么?
答案1
类似 Debian 的发行版依赖于一个名为“envvars”的文件,其中存放了许多变量。
从源代码编译的 Apache HTTPD 确实包含该文件,但它默认不会在那里放置那么多变量。
如果您尝试通过发行版默认以外的其他方式启动 Apache,或者由于文件丢失的任何特殊原因,所有这些变量最终都将未定义,因此 Apache HTTPD 将无法由于语法错误而启动。
根据 ubuntu.packages.com 它位于 /etc/apache2 内
您可以在以下位置进行检查:http://packages.ubuntu.com/search?searchon=contents&keywords=envvars&mode=exactfilename&suite=xenial&arch=any