ubuntu安装apache2出现"Config variable ${APACHE_LOCK_DIR} is not defined"问题的解决方法

由于做计网课设时需要用到apache2,所以开始在ubuntu上安装apache2;

安装挺简单的,只需要在ubuntu终端里输入:

sudo apt-get install apache2

然后回车就可以了;

然而,在安装成功准备运行的时候,却出现了问题如下所示:

[Fri Oct 14 20:27:03.977120 2016] [core:warn] [pid 4445] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined
[Fri Oct 14 20:27:03.977236 2016] [core:warn] [pid 4445] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Fri Oct 14 20:27:03.977267 2016] [core:warn] [pid 4445] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Fri Oct 14 20:27:03.977273 2016] [core:warn] [pid 4445] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Fri Oct 14 20:27:03.977283 2016] [core:warn] [pid 4445] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Fri Oct 14 20:27:03.979139 2016] [core:warn] [pid 4445:tid 140654039287680] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Fri Oct 14 20:27:03.981408 2016] [core:warn] [pid 4445:tid 140654039287680] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Fri Oct 14 20:27:03.981422 2016] [core:warn] [pid 4445:tid 140654039287680] 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}

找了很久才在http://serverfault.com/questions/558283/apache2-config-variable-is-not-defined里找到了和我情况类似的朋友的帖子,在回帖里发现了答案,回帖如下:

this message is displayed because you directly executed the apache2 binary. In Ubuntu/Debian the apache config

relies on the envvar file which is only activated if you start apache with the init script or apachectl.

your original problem is that you have no a proper hostname (fqdn) for your machine. if you can't change it, change the Ser verName variable in /etc/apache2/apache2.conf to localhost or your prefered FQDN.

大概意思就是apache的配置需要依赖envvar这个文件,但是这个文件只有在用init script或apachectl运行apache才有有效,所以我就试

了一下方法:

在ubuntu终端里直接输入

sudo apachectl start

结果apache2就成功跑起来了,至于为什么会这样,我就不清楚了,希望哪位大神可以解析一下;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值