【发布时间】: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"并将输出放在您的问题中,这可能会有所帮助。