apache啟動(dòng)報(bào)錯(cuò):httpd: apr_sockaddr_info_get() failed
重啟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 ServerName
究其原因是因?yàn)樵谂渲肈NS的時(shí)候hostname hoteel造成的,重新hostname localhost就可以了。
附:網(wǎng)上找到的相關(guān)文章
1、在啟動(dòng) httpd 時(shí)出現(xiàn)
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.
這個(gè)問(wèn)題應(yīng)該是沒(méi)有在 /etc/httpd/conf/httpd.conf 中設(shè)定 ServerName 所以它會(huì)用主機(jī)上的名稱來(lái)取代,首先會(huì)去找 /etc/hosts 中有沒(méi)有主機(jī)的定義。
所以要解決這個(gè)問(wèn)題可以設(shè)定 ServerName 或者在 /etc/hosts 中填入自己的主機(jī)名稱 MYHOST,像這樣:
>vi /etc/hosts
127.0.0.1 localhost.localdomain localhost MYHOST
2、在Linux下安裝完Apache 2.2.6,啟動(dòng)HTTP服務(wù)報(bào)錯(cuò)
[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
經(jīng)分析發(fā)現(xiàn)是apache的conf目錄下的配置文件httpd.conf中關(guān)于hostname設(shè)置和/etc/sysconfig/network中的HOSTNAME設(shè)置不統(tǒng)一導(dǎo)致的,修改成統(tǒng)一的主機(jī)名即可解決該問(wèn)題。
注:/etc/sysconfig/network 默認(rèn)主機(jī)名是:HOSTNAME=localhost.localdomain
PS:網(wǎng)上有這種辦法,似乎是沒(méi)用的,因?yàn)槲艺J(rèn)為apache在編譯安裝過(guò)程中會(huì)編譯ARP的,因此下述操作有點(diǎn)多余。
apr 和apr-util包含在Apache httpd的發(fā)行源代碼中,并且在絕大多數(shù)情況下使用都不會(huì)出現(xiàn)問(wèn)題。當(dāng)然,如果apr或apr-util的1.0或1.1版本已經(jīng)安裝在你的系統(tǒng)中了, 則必須將你的apr/apr-util升級(jí)到1.2版本,或者將httpd單獨(dú)分開(kāi)編譯。要使用發(fā)行源代碼中自帶的apr/apr-util源代碼進(jìn)行安 裝,你必須手動(dòng)完成:
# 編譯和安裝 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"
本機(jī)正確設(shè)定說(shuō)明 必須為同一的
[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
[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
# ServerName gives the name and port that the server uses to identify itself.
#ServerName www.example.com:80
ServerName 127.0.0.1
相關(guān)文章
詳解Ubuntu16.04啟動(dòng)器圖標(biāo)異常解決方法
本篇文章主要介紹了詳解Ubuntu16.04啟動(dòng)器圖標(biāo)異常解決方法,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2018-04-04linux實(shí)現(xiàn)定時(shí)備份mysql數(shù)據(jù)庫(kù)的簡(jiǎn)單方法
在本篇文章中我們給大家整理了一些關(guān)于linux實(shí)現(xiàn)定時(shí)備份mysql數(shù)據(jù)庫(kù)的簡(jiǎn)單方法,有需要的朋友們可以學(xué)習(xí)下。2018-09-09騰訊云(ubuntu)下安裝 nodejs + 實(shí)現(xiàn) Nginx 反向代理服務(wù)器
本文將介紹如何給騰訊云上的 Ubuntu Server 12.04 LTS 64位主機(jī)安裝 node 及 nginx,并簡(jiǎn)單配置反向代理。2016-11-11Linux安裝apache服務(wù)器的配置過(guò)程
這篇文章主要介紹了Linux安裝apache服務(wù)器的配置過(guò)程,啟動(dòng)apache的命令寫(xiě)法,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2021-11-11linux操作系統(tǒng)下配置ssh/sftp和權(quán)限設(shè)置方法
這篇文章主要介紹了linux操作系統(tǒng)下配置ssh/sftp和權(quán)限設(shè)置方法 ,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2018-11-11阿里云linux服務(wù)器安全設(shè)置(防火墻策略等)
這篇文章主要介紹了阿里云linux服務(wù)器安全設(shè)置,主要是針對(duì)防火墻策略等一些補(bǔ)充2016-10-10在CoreOS上搭建一個(gè)WordPress程序操作實(shí)例
你可能聽(tīng)過(guò)服務(wù)器操作系統(tǒng)CoreOS的名字,那你試過(guò)在上面建立個(gè)小程序么?今天,我們就來(lái)手把手地教你建立一個(gè)簡(jiǎn)單的WordPress程序2014-03-03