Apache Starting httpd: apr_sockaddr_info_get() failed
When I install apache in CentOS nowadays, I get a warning "Starting httpd: httpd: apr_sockaddr_info_get() failed for myservername， httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName" when I start httpd servers. It seems my website and apache server are all normal without any problems. When I look up this issue in Google, the result is that ServerName is not consistent with CentOS.
1. Default ServerName Settings
This tips about ServerName are copied from httpd/conf/httpd.conf :
# # ServerName gives the name and port that the server uses to identify itself. # This can often be determined automatically, but we recommend you specify # it explicitly to prevent problems during startup. # # If this is not set to valid DNS name for your host, server-generated # redirections will not work. See also the UseCanonicalName directive. # # If your host doesn't have a registered DNS name, enter its IP address here. # You will have to access it by its address anyway, and this will make # redirections work in a sensible way. # #ServerName www.example.com:80
ServerNames in /etc/hosts :
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
ServerName in /etc/sysconfig/network
2. Fix httpd: apr_sockaddr_info_get() failed
There are two methods for fixing, choise one as you prefered.
Only modify /etc/host
Add myservername declaration in the end of /etc/hosts :
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 myservername ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
Only modify httpd.conf