Apache apr_sockaddr_info_get() 失败错误

use*_*679 11 apache2

我的 apache 服务给了我错误,我只是在我的 AWS 云实例上使用了一个 snapshop,一切似乎都很好,我的网站一直在工作,直到我重新启动我的 apache,现在它给了我以下错误:

ubuntu@ip-10-0-0-217:/var/www$ sudo service apache2 restart
sudo: unable to resolve host ip-10-0-0-217
 * Restarting web server apache2 
apache2: apr_sockaddr_info_get() failed for ip-10-0-0-217
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
 ... waiting apache2: apr_sockaddr_info_get() failed for ip-10-0-0-217
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
Run Code Online (Sandbox Code Playgroud)

在用户端,This website is temporarily unavailable, please try again later.当他们尝试访问网站时会得到。

我怎样才能解决这个问题?

小智 14

我也遇到了这个问题,因为在 Ubuntu 14.04 上安装了 Apache 2.4。

当我意识到我在/etc/hosts文件中输入了错误的名称时,我最终修复了我的服务器名称设置/etc/hostnamethissrv2

i.e. hosts was (after I changed it) ...
127.0.0.1       localhost
::1             localhost ip6-localhost ip6-loopback
fe00::0         ip6-localnet
ff00::0         ip6-mcastprefix
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters
127.0.1.1       thissvr1
91.189.88.140   ports.ubuntu.com
91.189.95.83    ppa.launchpad.net
54.224.40.137   repo.linaro.org
Run Code Online (Sandbox Code Playgroud)

一旦我更正了下面的条目(现在符合/etc/hostname),错误就消失了

127.0.0.1       localhost
::1             localhost ip6-localhost ip6-loopback
fe00::0         ip6-localnet
ff00::0         ip6-mcastprefix
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters
127.0.1.1       thissvr2
91.189.88.140   ports.ubuntu.com
91.189.95.83    ppa.launchpad.net
54.224.40.137   repo.linaro.org
Run Code Online (Sandbox Code Playgroud)

希望这会导致其他人修复此类错误。


XiR*_*iR_ 8

当 apache 刚刚安装并且没有进行设置时会发生这种情况。无论如何,快速搜索 [1] 第一个结果提供以下配方:

要解决该问题,您需要编辑 httpd.conf 文件。打开终端并输入,

sudo nano /etc/apache2/httpd.conf
Run Code Online (Sandbox Code Playgroud)

默认情况下,httpd.conf 文件将为空白。现在,只需将以下行添加到文件中。

ServerName localhost
Run Code Online (Sandbox Code Playgroud)

保存文件并退出。最后重启服务器。

sudo /etc/init.d/apache2 restart
Run Code Online (Sandbox Code Playgroud)

[1] https://www.google.es/search?client=ubuntu&channel=fs&q=apache+fully+name&ie=utf-8&oe=utf-8&gfe_rd=cr&ei=hYmVU-ulHI7D8gedu4EY