apache2: Could not reliably determine the server’s fully qualified domain name, using 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
root@coding:~# head -n2 /etc/hosts    localhost localhost.localdomain    coding coding.localdomain
root@coding:~# cat /etc/apache2/httpd.conf
ServerName coding
root@coding:~# /etc/init.d/apache2 restart
Restarting web server: apache2 ... waiting .

Leave a Comment