opo 发表于 2018-11-26 13:29:08

Apache启动报127.0.0.1问题


[*]httpd: apr_sockaddr_info_get() failed for hoteel
[*]httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

我在service httpd restart的时候提示上述信息的。虽然启动成功了,但是也是很郁闷的。

这是因为我在配置DNS的时候hostname 造成的。

重新hostname localhost就可以了。

我在网上找来一些有关这方面的信息,加以整理就顺便贴在这里了。



解决办法非常简单:



1.

在启动 httpd 时出现:

Starting httpd: httpd: apr_sockaddr_info_get() failed for MYHOST

httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName.

这个问题应该是没有在 /etc/httpd/conf/httpd.conf 中设定 ServerName 所以它会用主机上的名称来取代,首先会去找 /etc/hosts 中有没有主机的定义。

所以要解决这个问题可以设定 ServerName 或者在 /etc/hosts 中填入自己的主机名称 MYHOST,像这样:




[*]#vi /etc/hosts
[*]127.0.0.1 localhost.localdomain localhost MYHOST

2.

现象:

bogon:~/webserver/httpd-2.0.59 # /usr/local/apache2/bin/apachectl start

httpd: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

httpd (pid 20183) already running



這個問題應該是沒有在 /etc/httpd/conf/httpd.conf 中設定 ServerName




[*]vi /usr/local/apache2/conf/httpd.conf

最简单的,修改httpd.conf文件,增加:




[*]ServerName www.example.com:80

我的改为:




[*]ServerName www.example.com:80
[*]



页: [1]
查看完整版本: Apache启动报127.0.0.1问题