apache2 无法在 ubuntu 中启动

apache2 无法在 ubuntu 中启动

我尝试执行systemctl start apache2,然后它没有显示任何错误。但是当我检查其状态时,它仍然处于非活动状态。如何解决这个问题?状态的输出如下:

    apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: inactive (dead) since Tue 2020-02-11 12:56:44 +04; 3s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 3372 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
  Process: 3356 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)

Feb 11 12:56:44 hadoop-HP-Pro3500-Series apache2[3356]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Feb 11 12:56:44 hadoop-HP-Pro3500-Series apache2[3356]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Feb 11 12:56:44 hadoop-HP-Pro3500-Series apache2[3356]: no listening sockets available, shutting down
Feb 11 12:56:44 hadoop-HP-Pro3500-Series apache2[3356]: AH00015: Unable to open logs
Feb 11 12:56:44 hadoop-HP-Pro3500-Series apache2[3356]: Action 'start' failed.
Feb 11 12:56:44 hadoop-HP-Pro3500-Series apache2[3356]: The Apache error log may have more information.
Feb 11 12:56:44 hadoop-HP-Pro3500-Series apache2[3356]:  *
Feb 11 12:56:44 hadoop-HP-Pro3500-Series apache2[3372]:  * Stopping Apache httpd web server apache2
Feb 11 12:56:44 hadoop-HP-Pro3500-Series apache2[3372]:  *
Feb 11 12:56:44 hadoop-HP-Pro3500-Series systemd[1]: Started LSB: Apache2 web server.

答案1

该错误表明它无法绑定或使用端口 80。当端口 80 被另一个进程使用时,就会发生这种情况。因此,请尝试更改 Apache 端口,然后服务应该会启动。注意:如果您安装了任何防火墙,请在防火墙中也打开此端口。

403 状态代码表示客户端无法访问所请求的资源。当不存在默认目录索引页或 .htaccess 文件阻止访问时,也可能会出现这种情况。

我建议检查 Apache 错误日志以正确了解您所遇到的错误。

相关内容