今天安装Apache httpd web服务器时,从官方网站上http://www.apache.org/dyn/closer.cgi下载httpd,而后在centos下解压,安装过程分为三部分:html
(1)./configureweb
(2)makeapache
(3)make install (须要root权限)centos
默认安装在/usr/sbin/下,执行apachectl start时候,提示以下错误:服务器
httpd: apr_sockaddr_info_get() failed for shiwei
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerNamedom
因而上网查了一下,根据前人的经验,问题终于解决了。总结一下,方便之后使用。ide
缘由:这个问题应该是没有在 /etc/httpd/conf/httpd.conf 中设定 ServerName。因此apache会用主机上的名称来取代,首先会去找 /etc/hosts 中有没有主机的定义。网站
解决办法:ui
(1)能够设定httpd.conf文件中的 ServerName,以下:ServerName localhost:80 spa
(2)在 /etc/hosts 中填入本身的主机名称 bogon,以下:127.0.0.1 shiwei (用户名称)
参考网址:
http://suo.iteye.com/blog/1096296