我一直尝试启动/重新启动 Apache2,但一次又一次地出现相同的错误。已经查阅了许多问题或难题,但没有人能够解决我的问题。使用带有 Apache2 和 php7.0 的 Ubuntu 18.04。
因此,问题是当我执行命令时:
/etc/init.d/apache2 restart
我收到此错误:
Restarting apache2 (via systemctl): apache2.serviceJob for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
failed!
正在执行:
systemctl status --no-pager --full apache2
返回:
apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: failed (Result: exit-code) since Mon 2018-10-15 16:05:21 -03; 2min 43s ago
Process: 529 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
out 15 16:05:21 ellian-Lenovo-ideapad-320-15IKB apachectl[529]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
out 15 16:05:22 ellian-Lenovo-ideapad-320-15IKB apachectl[529]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
out 15 16:05:22 ellian-Lenovo-ideapad-320-15IKB apachectl[529]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
out 15 16:05:22 ellian-Lenovo-ideapad-320-15IKB apachectl[529]: no listening sockets available, shutting down
out 15 16:05:22 ellian-Lenovo-ideapad-320-15IKB apachectl[529]: AH00015: Unable to open logs
out 15 16:05:21 ellian-Lenovo-ideapad-320-15IKB systemd[1]: apache2.service: Control process exited, code=exited status=1
out 15 16:05:22 ellian-Lenovo-ideapad-320-15IKB apachectl[529]: Action 'start' failed.
out 15 16:05:22 ellian-Lenovo-ideapad-320-15IKB apachectl[529]: The Apache error log may have more information.
out 15 16:05:21 ellian-Lenovo-ideapad-320-15IKB systemd[1]: apache2.service: Failed with result 'exit-code'.
out 15 16:05:21 ellian-Lenovo-ideapad-320-15IKB systemd[1]: Failed to start The Apache HTTP Server.
已经尝试修改 apache2.conf 以适应相似的问题的相同答案,但它不起作用。我是 Linux/Ubuntu 的新手。我曾经使用 Xampp 或 Wampp 执行本地服务器,但已经尝试在 Ubuntu 中安装它们但没有成功。
答案1
错误表明某些内容已绑定到端口 80。/etc/apache2/sites-available 中有一个默认站点配置文件,它绑定在端口 80 上。这可能是您想要编辑的用于绑定的文件,而不是使用 /etc/apache2/apache.conf 文件。如果您在 apache.conf 中定义了某些内容,那么它与 000-default.conf 文件相冲突,这就是它拒绝加载的原因。