linux Apache啟動提示 httpd: apr_sockaddr_info_get() failed for apache

來源:互聯網
上載者:User

httpd: apr_sockaddr_info_get() failed for hoteel
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
我在service httpd restart的時候提示上述資訊的。雖然啟動成功了,但是也是很鬱悶的。
這是因為我在配置DNS的時候hostname hoteel造成的。
重新hostname localhost就可以了。
我在網上找來一些有關這方面的資訊,就順便貼在這裡了。
1
在啟動 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

2
在Linux下安裝完Apache 2.2.6,啟動HTTP服務就報錯,似乎不影響服務的使用,但是也挺彆扭的。

[root@linux http]# ./apachectl start
httpd: apr_sockaddr_info_get() failed for linux(在BSD上是apr_sockaddr_info_get() failed for freebsdla)
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

經分析發現是apache的conf目錄下的設定檔httpd.conf中關於hostname設定和/etc/sysconfig/network中的HOSTNAME設定不統一導致的,修改成統一的主機名稱即可解決該問題。

註:/etc/sysconfig/network 預設主控件名是:HOSTNAME=localhost.localdomain

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.