apache startup error: httpd: apr_sockaddr_info_get of failed

  • 2020-05-06 12:09:28
  • OfStack

Restart apache:
service httpd restart
The reboot was successful, but it did give the following message:
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

The reason is that hostname hoteel is caused when DNS is configured. hostname localhost is ok.

attachment: related articles found online

1.
appears when httpd is started 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.
There should be no this problem in/etc httpd conf/httpd. Set the ServerName conf so it will use the name of the host to replace, first will have to find/etc hosts host definition.
So you can fix this by setting ServerName or by entering your own hostname MYHOST in /etc/hosts, like this:
> vi /etc/hosts
127.0.0.1 localhost.localdomain localhost MYHOST

2. After installing Apache 2.2.6 under Linux, start HTTP service and report an error
[root@linux http]# ./apachectl start
httpd: apr_sockaddr_info_get() failed for linux(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

After analysis, it was found that the configuration file httpd.conf in the conf directory of apache was not unified in the hostname Settings and HOSTNAME Settings in /etc/sysconfig/network.

Note: /etc/sysconfig/network default hostname is: HOSTNAME= localhost.localdomain

PS: this is available on the web and seems to be useless because I think apache will compile ARP during the build and install process, so the following is a bit redundant.

apr and apr-util are included in the Apache httpd distribution source code and are fine in most cases. Of course, if version 1.0 or 1.1 of apr or apr-util is already installed on your system, you must upgrade your apr/ apr-util to version 1.2, or compile httpd separately. To install the apr/ apr-util source code that comes with the distribution source code, you must do it manually:


#  Compile and install  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"

The correct setting of the machine indicates that it must be the same
[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


Related articles: