【问题标题】:Unable to restart apache on centoscentos无法重启apache
【发布时间】:2015-06-03 12:34:56
【问题描述】:

我有一个 centos 虚拟机,httpd -v 给了我以下输出

Server version: Apache/2.2.15 (Unix)
Server built:   Oct 16 2014 14:48:21

我使用以下命令关闭服务器: sudo /etc/init.d/httpd 停止

现在当我尝试启动服务器时,出现以下错误:

Starting httpd: httpd: apr_sockaddr_info_get() failed for bslm-022.corp.day.com
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
no listening sockets available, shutting down
Unable to open logs
                                                           [FAILED]

我在网上看到的here 是我应该在 /etc/apache2/httpd.conf 文件中添加 ServerName localhost 。 但我的虚拟机上没有名为 /etc/apache2 的目录

/etc/hosts 文件内容为:

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

$hostname 命令的结果是:

bslm-022.corp.day.com

我希望 apache 服务器为我在 localhost 上运行。

【问题讨论】:

  • 在错误中查看第 3 行:没有可用的侦听套接字。看起来其他东西可能正在使用它需要的端口。关于合格域名的第 2 行更多的是通知,不应导致服务器无法启动。
  • 还可以尝试运行lsof -i -P | grep -i "listen" 并将输出放在您的问题中,这可能会有所帮助。

标签: linux apache


【解决方案1】:

确保在您的 httpd.conf 中有“Listen 80”或在您的任何 conf 文件中的 /etc/httpd/conf.d/*

如果确实如此,请查看 netstat 以了解正在收听的内容

netstat -tunlp

【讨论】:

    猜你喜欢
    • 2016-11-12
    • 1970-01-01
    • 1970-01-01
    • 2017-07-21
    • 2018-04-28
    • 1970-01-01
    • 2021-04-12
    • 1970-01-01
    • 2020-07-09
    相关资源
    最近更新 更多