---
title: "如何解决linux下apache启动时httpd: apr_sockaddr_info_get() failed for 报错"
author: "wode66"
date: "2011-06-17T12:52:40Z"
tags: []
categories: ["操作系统"]
slug: "linux-apache-httpd-apr-sockaddr-info-get-failed-for"
draft: false
lastmod: "2011-06-17T12:55:27Z"
id: 1096296
url: "https://suo.iteye.com/blog/1096296"
---

今天在家里的RHLE5.5上安装apache的时候，先用user1用户./configure命令配置，然后才用root用户make && make install，结果apache起来的时候就报如下错误：

 

     httpd: apr\_sockaddr\_info\_get() failed for **bogon**

     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。所以apache会用主机上的名称来取代，首先会去找 /etc/hosts 中有没有主机的定义。**

**所以要解决这个问题可以设定httpd.conf文件中的 ServerName，如下：**

   (1) ServerName localhost:80                        

   **或者在 /etc/hosts 中填入自己的主机名称 bogon，如下**：

   (2)127.0.0.1 **bogon**

 

 

**注意**：

当前系统的主机名请以hostname命令为准，/etc/sysconfig/network中的HOSTNAME设置有可能不一致。

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