今天在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 HdhCmsTestexample测试数据: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启动报告httpd: apr_sockaddr_info_get() failed错误的详细内容...