apache服务器启动时提示httpd: apr_sockaddr_info_get() failed for
在RedHat Linux 5 与 CentOS 5服务器上配置好apache后,启动或者关闭时总要报个错: httpd: apr_sockaddr_info_get() failed for XX(主机名)
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName 虽然说并不影响apache的正常启动!但总感觉好像哪有问题。因为进程里会卡一个apache启动进程
找了下资料,原来是主机名设置不对造成的!没有在 /etc/httpd/conf/httpd.conf 中设定 ServerName 所以它会用主机上的名称来取代,首先会去找 /etc/hosts 中有没有主机的定义。 所以要解决这个问题可以设定 ServerName 或者在 /etc/hosts 中填入自己的主机名称 MYHOST,像这样:
vi /etc/hosts 127.0.0.1 localhost.localdomain localhost XX(主机名)
查看主机名的命令是:hostname
可能出现的另外的错误: [root@bogon xy]# service httpd restart Stopping httpd: [ OK ] Starting httpd: 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
解决方法: 将httpd.conf中的ServerName 前面的 # 去掉。 RedHat 5 与 CentOS 中的配置文件在 /etc/httpd/conf/httpd.conf (这是操作系统默认安装路径)