AH00015:无法打开日志操作“启动”失败。在Ubuntu 14.04中


10

我正在尝试安装apache2,我遇到了这个问题。请给我一些解决方案

重新启动Web服务器apache2会出现错误:

    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
(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.
The Apache error log may have more information.
[fail]
 * The apache2 instance did not start within 20 seconds. Please read the log files to discover problems

您可以发布您的apache配置文件吗?
Lety

抱歉,如何获取apache配置文件?
narru033 2014年

应该是/etc/apache2/apache2.conf/etc/apache2/sites-enabled/000-default.conf如果您定义了/etc/apache2/sites-available/yourFile.conf
Lety

Answers:


8

sudo netstat -tulpn | grep :80

你会得到类似的输出

tcp        0      0 0.0.0.0:80         0.0.0.0:*      LISTEN     1066/lighttpd

注意监听端口的进程的pid,在我的例子中是1066。然后运行

sudo kill -9 1066

记住将pid更改为正在监听端口的pid,它可能与1066不同


1

像许多服务器应用程序一样,您不能绑定到已经被另一个应用程序绑定的端口(在本例中,端口80为http)。错误的原因是Apache无法绑定到端口80,因为其他端口已经在监听该端口。

运行sudo netstat -tulpn | grep :80并查找在端口80上侦听的进程的名称。然后,重新配置或删除该程序。


1

您正在哪种类型的服务器上运行?

解决第一个错误

AH00558:apache2:无法使用127.0.1.1可靠地确定服务器的标准域名。全局设置“ ServerName”指令以禁止显示此消息

您将需要编辑httpd.conf文件,添加以下行:

ServerName localhost

要解决其他错误,您应确保尝试使用root特权运行Apache。

sudo /usr/sbin/apachectl start

1
这不是他们真正的错误。
托马斯·沃德

我没有httpd.conf档案。我可以把那条线放进去apache2.conf吗?
JohnK

设置ServerNamehttpd.conf没有任何效果。
塞林

1

我有着同样的问题。

我尝试通过以下博客在WSL上安装LAMP:WSL上的LAMP,但是当我发出此命令时:

/etc/init.d/apache2 start  

我遇到了同样的错误:

 * Starting Apache httpd web server apache2                                                                             
(13)Permission denied: AH00072: make_sock: could not bind to address [::]:80
(13)Permission denied: 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.
The Apache error log may have more information.
*

我以前曾尝试在Windows上正确安装Nginx并失败了,但我记得我已将Nginx绑定到端口80。问题是我不是Linux专家,我无法在apache2 conf文件中看到该区域绑定到端口。

我尝试跑步:

sudo netstat -tulpn | grep :80

一无所有。我还转发了路由器中的端口,因此我不明白如何解决该错误。

我知道Nginx没有在运行,所以端口80应该很好,但我认为铬也在端口80上运行。因此,沮丧的是我不知道会发生什么,我sudo像这样进行命令:

sudo  /etc/init.d/apache2 start  

我得到:

 * Starting Apache httpd web server apache2                                                                              
 *

通过使用start命令sudo继续运行,Apache2有权运行。这是一个短期解决方案,因为不建议以root特权运行Apache2(因此我们被告知),因此该解决方案仍然存在,但是到目前为止,我至少可以继续进行测试。

如果有人知道解决方案,请告诉我们。


@Yufenyuy谢谢。我尝试捕获所有代码,但是……
seanbw

... @ seanbw,不客气。这就是我们在社区中的原因……
ThunderBird

@Yufenyuy我得到的编辑。最。您能否给我一个链接,该链接教我如何将sudo之类的单词标记为句子的一部分,因为我看到sudo拥有自己的格式,但没有单独的一行。谢谢
seanbw

... @ seanbw您可以在`和`example之间加上单词sudo,以使其具有这种格式...希望您弄清楚。
ThunderBird

0

您可能安装了新的Web服务器或保留了端口80的任何端口,请检查您的服务以及新安装的产品


0

在我的情况下,这不是日志问题,但实际上是该Listen指令-它设置为在不存在的IP上侦听(因为我将笔记本电脑移至另一个网络)。

这只是在我卸载了服务,重新安装后才浮出水面,上面写着:

(OS 10049) The requested address is not valid in its context. : AH00072: make_sock: could not bind to address 0.0.0.0:80 AH00015: Unable to open logs

因此,我只是注释掉了令人反感的Listen指令(并保留其他指令)。

我知道Q是关于Ubuntu的,但是其他人可能会在这里遇到问题。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.