在啟動 httpd 時出現
Starting httpd: httpd: apr_sockaddr_info_get() failed for MYHOST
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 所以它會用主機上的名稱來取代,首先會去找 /etc/hosts 中有沒有主機的定義。
所以要解決這個問題可以設定 ServerName 或者在 /etc/hosts 中填入自己的主機名稱 MYHOST,像這樣:
>vi /etc/hosts 127.0.0.1 localhost.localdomain localhost MYHOST
或者
vi /etc/httpd/conf/httpd.conf
找到 ServerName
可能已經被註解了,這時只要將註解符號拿掉,再取個適當的名稱即可解決!
ServerName 的設定
其實 ServerName 在大部份的情況下可以不設定,但是如果有做重新導向的話,那麼如果這個值不存在,Apache 在啟動時會以 127.0.0.1 來做預設的 ServerName。因此等到有預到重新導向的情況時,就會出現問題。要更正這個問題,只要加入一個 ServerName 的值就可以了。
[[email protected] conf]# vi httpd.conf _______________________________ ServerName www.abc.com.tw
Hits: 386