Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux技術

修掉 Apache 啟動時的 apr_sockaddr_info_get() failed

我安裝 Apache 時,先用 user1 身分執行 ./configure,之後才用 root 執行 make && make install,結果啟動時跳出:

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

雖然不影響使用,但看著錯誤總是彆扭。查證之後發現,問題出在 /etc/httpd/conf/httpd.conf 裡沒有設定 ServerName,於是 Apache 改用主機名稱代替,並先去 /etc/hosts 裡找該主機的定義,找不到就報錯。

解法有兩個方向。

(1)在 httpd.conf 中明確指定:

ServerName localhost:80

(2)或者在 /etc/hosts 裡補上自己的主機名稱:

127.0.0.1 bogon

注意:目前系統的主機名稱請以 hostname 指令的結果為準,/etc/sysconfig/network 中的 HOSTNAME 設定有可能不一致——該檔預設值是 HOSTNAME=localhost.localdomain。

Copyright © Linux教程網 All Rights Reserved