Apache2 未在 Ubuntu Server 上运行

Apache2 未在 Ubuntu Server 上运行

在我使用 gitlab 管理文件之前,Apache 在我的服务器上运行良好。我尝试重新启动 Apache,但出现以下错误

(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Action 'start' failed.

我检查了我的日志,这是我看到的错误

[Thu Jul 23 17:00:26.511870 2015] [core:warn] [pid 32588] AH00111:
Config variable ${APACHE_LOCK_DIR} is not defined [Thu Jul 23
17:00:26.512033 2015] [core:warn] [pid 32588] AH00111: Config variable
${APACHE_PID_FILE} is not defined  [Thu Jul 23 17:00:26.512057 2015]
[core:warn] [pid 32588] AH00111: Config variable ${APACHE_RUN_USER} is
not defined  [Thu Jul 23 17:00:26.512068 2015] [core:warn] [pid 32588]
AH00111: Config variable ${APACHE_RUN_GROUP} is not defined [Thu Jul
23 17:00:26.512108 2015] [core:warn] [pid 32588] AH00111: Config
variable ${APACHE_LOG_DIR} is not defined [Thu Jul 23 17:00:26.516040
2015] [core:warn] [pid 32588:tid 140305255098240] AH00111: Config
variable ${APACHE_LOG_DIR} is not defined [Thu Jul 23 17:00:26.516255
2015] [core:warn] [pid 32588:tid 140305255098240] AH00111: Config
variable ${APACHE_LOG_DIR} is not defined [Thu Jul 23 17:00:26.516283
2015] [core:warn] [pid 32588:tid 140305255098240] 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}

请帮忙。我已经被这个问题困扰好几天了。

答案1

这些错误表明:

  • 端口 80 上已有一个 Web 服务器正在运行,因此您无法启动另一个
  • Apache 找不到其 PID 或锁定文件,因为它缺少一些配置,并且不知道在哪里查找

我认为正在发生的情况是:

  • 另一个 Web 服务器已在端口 80 上运行是 Apache 本身它无法识别自己的原因是它找不到自己的 PID 文件,因此它无法判断 Apache 已在运行。

为了使服务能够使用脚本自行重启或停止,它需要在某处保留其作为哪个进程运行的记录。该记录存储在 PID 文件中。PID 文件告诉重启/停止脚本服务已在哪个进程下运行,从而允许停止服务。如果没有它,重启/停止脚本甚至不知道服务已在运行,更不用说它作为哪个进程运行了。

您需要检查您的 Apache 配置目录,因为可能缺少或损坏了某些内容。如果您找不到原因并且绝望,请记录您对 Apache 配置所做的任何自定义,然后清除并重新安装 Apache,然后手动恢复您的自定义。

这可能是由 gitlab 引起的吗?可能的虽然不确定。有些软件喜欢将文件添加到 Apache 的配置中,例如。/etc/apache2/conf.d/检查该目录是否有任何看起来像是由 gitlab 或其他第三方软件添加的内容。

答案2

所有这些变量都是在/etc/apache2/envvars我的服务器中定义的。检查该文件是否存在以及是否正确设置。我想我必须对它进行一些小改动,但基本上可以按下载的原样使用它。

相关内容