I'm trying to restart Apache 2:
sudo service apache2 restart
But get the below error:
* Restarting web server 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
I've tried to change
sudo gedit /etc/apache2/httpd.conf
A blank file appears, and I'd added this:
ServerName localhost
But that error doesn't disappear!
How can I fix this problem?
I found this: How do I restart/reload Apache when it can't determine the domain name?
Specifying
ServerName localhost
in your configuration files outside of the virtual host sections is the way to do this.Other answers suggest that you should modify
/etc/apache2/httpd.conf
. This file gets overwritten when apache gets upgraded from apt. For Apache configuration that you don't want to get overwritten, you should create a new file. Here is the "Debian way" to make this configuration change:Your localhost IP Address should be 127.0.0.1, instead of 127.0.1.1. Please setup your
/etc/hosts
file properly. Then edit thehttpd.conf
file:When a blank file appears, please add this line, then save:
Here is another Solution:
Before:
Added
192.168.226.131 centos.wks.local
in/etc/hosts
fileNote: 192.168.226.131 is my Apache server IP address.
After: