apache啓動報錯:httpd: apr

httpd: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName
重啓apache:
service httpd restart
雖然重啓成功,但卻給出以下的提示信息:
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 ServerNamelinux

究其緣由是由於在配置DNS的時候hostname hoteel形成的,從新hostname localhost就能夠了。spring

附:網上找到的相關文章apache

一、在啓動 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,像這樣:less

vi /etc/hosts
127.0.0.1 localhost.localdomain localhost MYHOSTdom

二、在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 ServerNameui

經分析發現是apache的conf目錄下的配置文件httpd.conf中關於hostname設置和/etc/sysconfig/network中的HOSTNAME設置不統一致使的,修改爲統一的主機名便可解決該問題。rest

注:/etc/sysconfig/network 默認主機名是:HOSTNAME=localhost.localdomainserver

PS:網上有這種辦法,彷佛是沒用的,由於我認爲apache在編譯安裝過程當中會編譯ARP的,所以下述操做有點多餘。vps

apr 和apr-util包含在Apache httpd的發行源代碼中,而且在絕大多數狀況下使用都不會出現問題。固然,若是apr或apr-util的1.0或1.1版本已經安裝在你的系統中了, 則必須將你的apr/apr-util升級到1.2版本,或者將httpd單獨分開編譯。要使用發行源代碼中自帶的apr/apr-util源代碼進行安 裝,你必須手動完成:rem

複製代碼 代碼以下:

編譯和安裝 apr 1.2

apr
./configure --prefix=/x/httpd/apr
make
make install
apr-util
./configure --prefix=/x/httpd/apr_util --with-apr=/x/httpd/apr
make
make install
apache
./configure --prefix=/x/httpd/apache2 
–enable-so 
–enable-cgi 
–enable-rewrite 
–enable-mods-shared=all 
–with-apr=/x/httpd/apr 
–with-apr-util=/x/httpd/apr_util
LDFLAGS="-L/usr/lib64 -L/lib64"

本機正確設定說明 必須爲同一的
[root@spring ~]# nl /etc/hosts
1 # Do not remove the following line, or various programs
2 # that require network functionality will fail.
3 127.0.0.1 localhost.localdomain spring

http://www.iis7.com/a/lm/vpsdq/

[root@spring ~]# nl /etc/sysconfig/network
1 NETWORKING=yes
2 NETWORKING_IPV6=no
3 HOSTNAME=spring
4 #GATEWAY=192.168.8.1

[root@spring ~]# less /etc/httpd/conf/httpd.conf|grep ServerName

相關文章
相關標籤/搜索