解决Apache启动时错误提示

Starting httpd: httpd: apr_sockaddr_info_get() failed for centos-minimal.xxxx.com

apache启动时提示apr_sockaddr_info_get()错误,是因为/etc/hosts和hostname不一致造成的。

使用hostname命令查到服务器的主机名称:

#> hostname
centos-minimal.xxxx.com

打开/etc/hosts文件,原先的内容应该是这样的:

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

将刚才查到的主机名称加到最后:

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4 centos-minimal.xxxx.com
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6 centos-minimal.xxxx.com

重启httpd服务,这样就不会提示apr_sockaddr_info_get()错误了。

Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using centos-minimal.xxxx.com for ServerName

这是因为没有在httpd.conf设置ServerName造成的,httpd启动时就会使用hostname作为服务器的名称。这其实不应该说是错误,可以算作一条警告。

打开/etc/httpd/conf/httpd.conf,找到ServerName:

#ServerName www.example.com:80

修改成实际的主机名称:

ServerName centos-minimal.xxxx.com:80

重启httpd服务,上面的警告信息应该就不会有了。

原文地址:https://www.cnblogs.com/eastson/p/2574910.html