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

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

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

在RedHat Linux 5 與 CentOS 5服務器上配置好apache後,啓動或者關閉時總要報個錯: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啓動進程dom

找了下資料,原來是主機名設置不對形成的!沒有在 /etc/httpd/conf/httpd.conf 中設定 ServerName 因此它會用主機上的名稱來取代,首先會去找 /etc/hosts 中有沒有主機的定義。
因此要解決這個問題能夠設定 ServerName 或者在 /etc/hosts 中填入本身的主機名稱 MYHOST,像這樣:
> vi /etc/hosts
127.0.0.1   localhost.localdomain   localhost   XX(主機名)ide

查看主機名的命令是:hostnamepost

 

可能出現的另外的錯誤:操作系統

[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.net

解決方法:rest

將httpd.conf中的ServerName 前面的 # 去掉。
RedHat 5 與 CentOS 中的配置文件在 /etc/httpd/conf/httpd.conf   (這是操做系統默認安裝路徑)

相關文章
相關標籤/搜索