今天安裝Apache httpd web服務器時,從官方網站上http://www.apache.org/dyn/closer.cgi下載httpd,然後在centos下解壓,安裝過程分爲三部分:
(1)./configure
(2)make
(3)make install (需要root權限)
默認安裝在/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 ServerName
於是上網查了一下,根據前人的經驗,問題終於解決了。總結一下,方便以後使用。
原因:這個問題應該是沒有在 /etc/httpd/conf/httpd.conf 中設定 ServerName。所以apache會用主機上的名稱來取代,首先會去找 /etc/hosts 中有沒有主機的定義。
解決辦法:
(1)可以設定httpd.conf文件中的 ServerName,如下:ServerName localhost:80
(2)在 /etc/hosts 中填入自己的主機名稱 bogon,如下:127.0.0.1 shiwei (用戶名稱)
參考網址:
http://suo.iteye.com/blog/1096296
http://blog.chinaunix.net/uid-21516619-id-1824989.html
http://blog.csdn.net/lyjtynet/article/details/4213173