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

softyun3年前云服务器38

重启apache:
service httpd restart
虽然重启成功,但却给出如下的提示信息:
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

究其原因是因为在配置DNS的时候hostname hoteel造成的,重新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、在Linux下安装完Apache 2.2.6,启动HTTP服务报错
[root@linux http]# ./apachectl start
httpd: apr_sockaddr_info_get() failed for linux(在BSD上是apr_sockaddr_info_get() failed for freebsdla)
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

经分析发现是apache的conf目录下的配置文件httpd.conf中关于hostname设置和/etc/sysconfig/network中的HOSTNAME设置不统一导致的,修改成统一的主机名即可解决该问题。

注:/etc/sysconfig/network 默认主机名是:HOSTNAME=localhost.localdomain

PS:网上有这种办法,似乎是没用的,因为我认为apache在编译安装过程中会编译ARP的,因此下述操作有点多余。

apr 和apr-util包含在Apache httpd的发行源代码中,并且在绝大多数情况下使用都不会出现问题。当然,如果apr或apr-util的1.0或1.1版本已经安装在你的系统中了, 则必须将你的apr/apr-util升级到1.2版本,或者将httpd单独分开编译。要使用发行源代码中自带的apr/apr-util源代码进行安 装,你必须手动完成:

 

复制代码 代码如下:

# 编译和安装 apr 1.2
apr
./configure --prefix=/x/httpd/apr
make
make install
apr-util
./configure --prefix=/x/httpd/apr_util --with-apr=/x/httpd/apr
make
make install
apache
./configure --prefix=/x/httpd/apache2 \
--enable-so \
--enable-cgi \
--enable-rewrite \
--enable-mods-shared=all \
--with-apr=/x/httpd/apr \
--with-apr-util=/x/httpd/apr_util
LDFLAGS="-L/usr/lib64 -L/lib64"

 

本机正确设定说明 必须为同一的
[root@spring ~]# nl /etc/hosts
     1 # Do not remove the following line, or various programs
     2 # that require network functionality will fail.
     3 127.0.0.1 localhost.localdomain spring

[root@spring ~]# nl /etc/sysconfig/network
     1 NETWORKING=yes
     2 NETWORKING_IPV6=no
     3 HOSTNAME=spring
     4 #GATEWAY=192.168.8.1

[root@spring ~]# less /etc/httpd/conf/httpd.conf|grep ServerName
# ServerName gives the name and port that the server uses to identify itself.
#ServerName example:80
ServerName 127.0.0.1

免责声明:本文内容来自用户上传并发布,站点仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。请核实广告和内容真实性,谨慎使用。

相关文章

哪些因素会影响香港服务器稳定性?

香港服务器稳定性,直接关系到用户网站的稳定性,进而影响搜索引擎(百度、谷歌等)对网站的排名评估。香港服务器不稳定,会导致网站服务中断,造成网站排名下降,严重的甚至会导致网站被K站。那么哪些因素会影响香...

香港服务器托管费用受哪些因素影响

影响香港服务器托管费用的因素:1. 注意托管的机房配置,不同档次的配备价格不同,还要注意机柜大小。2. 不同的托管时长套餐,价格有差异, 根据业务的因素选择最合适最划算的托管方案进行托管。 3. ip...

视频网站租用美国服务器好吗

视频网站租用美国服务器好:1、美国服务器内地访问速度较快,且稳定性好,网络延迟低,能保障视频播放的流畅性;2、美国服务器不用备案,且对网站内容限制较少,能快速搭建视频网站;3、美国服务器有充足的国际带...

美国cn2高防服务器租用防御好吗

美国CN2高防服务器租用的防御能力相对较强,可以抵御大规模的DDoS攻击,保障服务器的稳定运行。美国CN2高防服务器租用相比其他服务器租用具有以下优势:1、防御能力强CN2高防服务器具有强大的DDoS...

国内主机和香港主机有哪些不同

国内主机和香港主机的不同点有:1、国内主机需要备案,香港主机不需要备案,能实现快速使用;2、国内主机的配置比香港主机的较差,香港主机的稳定性高,基本不会出现宕机的情况;3、国内多线主机的价格要比香港主...

高防服务器是怎么防御黑客攻击

高防服务器是防御黑客攻击的方式:1. 高防服务器的软件防御,利用寄生于操作平台上的软件防火墙来实现隔离内部网与外部网之间的一种保护屏障。2. 高防服务器的硬件防御,通过机房的带宽冗余、机器的处理速度来...