DEV Community

Cover image for “Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName” Error on Ubuntu
Ayekple Clemence
Ayekple Clemence

Posted on • Originally published at anansewaa.com

“Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName” Error on Ubuntu

“Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName“. I get this error upon restarting Apache Server on a server running Ubuntu 16.04. This occurs because the ServerName is not set.

sudo systemctl restart apache2

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Enter fullscreen mode Exit fullscreen mode

To fix this problem, we need to edit the apache2.conf file. Open the terminal and type this command:

sudo nano /etc/apache2/apache2.conf
Enter fullscreen mode Exit fullscreen mode

However, at the very bottom of that file and add this line:

ServerName localhost
Enter fullscreen mode Exit fullscreen mode

This should solve the problem and the error code AH00558 should now be gone. Now restart the Apache server using the following command:

sudo systemctl restart apache2
Enter fullscreen mode Exit fullscreen mode

I hope this article helps.

How to Set or Change System Hostname in Linux

Top comments (2)

Collapse
 
elleon003 profile image
elleon003

Thank you! This was driving me crazy!!

Collapse
 
ayekpleclemence profile image
Ayekple Clemence

I hope the post helped