首页 > 开发 > Apache > 正文

解决apache的apr_sockaddr_info_get() failed错

2018-10-16 21:21:41
字体:
来源:转载
供稿:网友

在Linux下安装完Apache 2.2.6,启动HTTP服务就报错,似乎不影响服务的使用,但是也挺别扭的。
-------------------------------------------------------------------------------------
[root@linux http]# ./apachectl start
httpd: apr_sockaddr_info_get() failed for linux
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
cd srclib/apr
./configure --prefix=/usr/local/apr-httpd/
make
make install

# 编译和安装 apr-util 1.2
cd ../apr-util
./configure --prefix=/usr/local/apr-util-httpd/ --with-apr=/usr/local/apr-httpd/
make
make install

# 配置 httpd
cd ../../
./configure --with-apr=/usr/local/apr-httpd/ --with-apr-util=/usr/local/apr-util-httpd/
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表