How to fix Apache could not reliably determine FQDN Error on Ubuntu

You might probably faced the same following error while you were restarting the Apache server on Ubuntu.

* Restarting web server apache2 apache2: apr_sockaddr_info_get() failed for server
apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName
… waiting apache2: apr_sockaddr_info_get() failed for serverapache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName

So in this short guide I will show you how to fix an error happens on Apache-based server with above message output.

HOW TO FIX FQDN ISSUE ON APACHE2

Step 1 – Login to your server via SSH. You can use either Putty on Windows or Terminal if you are on Linux. better login as root or as a user with root privilege.

Step 2 – Now issue following command:

nano /etc/apache2/httpd.conf

Step 3 – By default httpd.conf file will be blank. Now, simply add the following line to the file.

ServerName localhost

Once done save the file and exit the editor.

Step 4 – Next, restart Apache2 service. There are two most common commands used to do this. You can use either..

/etc/init.d/apache2 restart
or
service apache2 restart

That’s it. Now you will not see this error anymore.