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

Problem:

user@localhost:~$ sudo service apache2 restart

 * Restarting web server apache2                                           
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
 ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName



Solution:

Open and edit your apache.conf

      sudo gedit /etc/apache2/apache.conf

Into the file write on top:

    ServerName localhost


Save the file.

Restart your apache.


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



Another way is open edit  your hosts

     sudo gedit /etc/hosts



127.0.0.1 localhost
127.0.1.1 ubuntu #your hostname
127.0.0.1 server.domain.com #your local ip and domain name
192.168.1.1 server.domain.com #your network card Internal IP address and domain name
202.123.123.123 server.domain.com #your external/Public IP address and domain name
 
 
Save the file.

Restart your network.

    sudo /etc/init.d/networking restart or sudo service networking restart

Restart your apache.

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

Comments