apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName

on local webservers without specific domain I often came over the stated apache warning. Here is how to get rid of it:

  • Check your /etc/hosts that there are entries for localhost, localhost.domainname, hostname, hostname.domainname.
  • Last edit /etc/apache2/httpd.conf and add ServerName hostname to the file.
  • Restart apache
root@coding:~# hostname --fqd
coding
root@coding:~# head -n2 /etc/hosts
127.0.0.1    localhost localhost.localdomain
192.168.56.10    coding coding.localdomain
root@coding:~# cat /etc/apache2/httpd.conf
ServerName coding
root@coding:~# /etc/init.d/apache2 restart
Restarting web server: apache2 ... waiting .
root@coding:~#

Leave a Reply