Keep on going, never give up.

apache启动报告httpd: apr_sockaddr_info_get() failed错误

今天在CentOS上调试Apache时,发现报告Starting httpd: httpd: apr_sockaddr_info_get() failed for myservername, httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName,但是启动还是正常启动,而且网站也可以正常使用,后来查了一下。发现是ServerName不统一的问题,修正OK。

基础知识:

Linux HostName修改设置

一、默认ServerName相关配置

1、下面是httpd/conf/httpd.conf关于ServerName说明:

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If this is not set to valid DNS name for your host, server-generated
# redirections will not work.  See also the UseCanonicalName directive.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
# You will have to access it by its address anyway, and this will make
# redirections work in a sensible way.
#
#ServerName www.example.com:80

2、下面是/etc/hosts里面的名称:

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

3、下面是/etc/sysconfig/network内容:

NETWORKING=yes
HOSTNAME=myservername

二、解决httpd: apr_sockaddr_info_get() failed错误

修正方法有两种:

1、不打开apache的httpd.conf关于ServerName申明,只修改/etc/hosts

/etc/hosts修改内容如下(最后添加myservername申明):

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

2、直接修改httpd.conf关于ServerName定义

ServerName myservername:80

以上方法任选一种均可解决。

更多APACHE配置文章:

CentOS安装Apache+PHP+MySQL指南

Ubuntu上如何开启Apache Rewrite功能

Ubuntu下APACHE HTTPS安装和配置

Ubuntu VPS安装Apache+PHP+MySQL指南

完美解决IIS和APACHE的301重定向

Apache服务器httpd.conf配置文件说明

相关评论(0):  

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

订阅博客

最新文章

本站采用创作共用版权协议, 要求署名、非商业用途和保持一致. 转载也必须遵循“署名-非商业用途-保持一致”的创作共用协议. 返回顶部
Copyright@2005-2016 Metsky.com, All rights Reserved.