Can’t restart Apache in Ubuntu

When I try to restart Apache using the command:

sudo apachectl -k restart

I get this error:

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

Solution: Edit httpd.conf:

sudo vi /etc/apache2/httpd.conf

Press “i” to insert

ServerName localhost

Then press “:x” to save.

Now you can restart Apache:

sudo apachectl -k restart