网站地图    收藏   

主页 > 后端 > php资料库 >

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

来源:自学PHP网    时间:2014-12-04 22:12 作者: 阅读:

[导读] 今天在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,但是启动...

今天在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。

一、默认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

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

自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习

京ICP备14009008号-1@版权所有www.zixuephp.com

网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com

添加评论