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

softyun3年前云服务器91

重启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

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

相关文章

香港服务器为什么会不稳定

香港服务器会出现不稳定的原因有:1、香港服务器网络出现故障导致;2、香港服务器配置不匹配导致;3、香港服务器中后台运行的程序过多导致;4、网站定位不恰当,在选择香港服务器时,没有根据业务需求选择导致。...

美国切片服务器可使用的安全软件有哪些

美国切片服务器可使用的安全软件有:1、统一集中化管理工具,如Puppet、Func工具;2、最小权限访问控制策略工具,如IPSec、IPTABLES等;3、补丁与反病毒工具,如WSUS等;4、监控体系...

使用上海VPS访问速度为什么会变慢

使用上海VPS访问速度变慢的原因有:1、上海VPS遭受病毒木马的毒害,导致网速变慢;2、上海VPS带宽不足或负载过大,超出了vps承受能力导致网速变慢;3、过多使用上海VPS的防火墙功能,多余的功能容...

租用便宜的香港服务器流量超标怎么解决

租用便宜的香港服务器流量超标解决的方法:1、网站资源被搜索引擎过度抓取,通过robot文件禁止引擎收录,达到减少部分流量的目的;2、网站有大量垃圾信息,清理ftp cache member中的垃圾缓存...

服务器如何做好日常维护安全

服务器做好日常维护安全的方法:1、需要避免使用密码访问服务器,通过SSH协议远程登录,降低服务器密码被恶意破解;2、需要及时给服务器扫描恶意软件和病毒,排查潜在安全隐患并进行处理;3、使用服务器访问时...

国外云主机租用有哪些优点

国外云主机租用的优点有:1、国外云主机租用价格低,能节省维护硬件和网络设施的成本,提高企业运维效率;2、国外云主机抗灾容错能力强,能保证长时间在线,保障网站的正常运营和避免数据丢失;3、国外云主机可扩...