apache服務器啓動時提示httpd: apr_sockaddr_info_get() faile

apache服務器啓動時提示httpd: apr_sockaddr_info_get() failed for

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   (這是操作系統默認安裝路徑)


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章