LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Error message when I restart Apache (https://www.linuxquestions.org/questions/linux-server-73/error-message-when-i-restart-apache-4175593892/)

StuartK24 11-20-2016 02:53 AM

Error message when I restart Apache
 
When I restart Apache, I get the following message.

* 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 am new to apache and using servers so excuse my ignorance. I have looked for the 'ServerName' directive in apache2.conf and cannot see anything of relevance. I also did, at one stage, change my '/etc/hosts' file without backing up the original. So I suspect this may be causing the problem, but I don't know how to fix it.
Like I said, I'm a beginner and at a bit of a loss. Any help would be greatly appreciated.

bathory 11-20-2016 03:32 AM

Quote:

When I restart Apache, I get the following message.

* 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 am new to apache and using servers so excuse my ignorance. I have looked for the 'ServerName' directive in apache2.conf and cannot see anything of relevance. I also did, at one stage, change my '/etc/hosts' file without backing up the original. So I suspect this may be causing the problem, but I don't know how to fix it.
You didn't mention your distro, but I guess you're running Mint as in your profile, even though the following applies to all.

Apache complains because it can't find a ServerName.
That happened because you messed with /etc/hosts. Have a look here to see how it should look like (of course use your own IP(s) and hostnames).

You can also edit apache2.conf and add:
Code:

ServerName www.mydomain.com
The hostname used in the ServerName directive it's better to match the one in /etc/hosts (but not necessarily)

Regards

Habitual 11-21-2016 10:02 AM

terminal >
Code:

sudo echo "ServerName localhost" >> /etc/apache2/apache2.conf
sudo apache2ctl graceful

done.

or add
Code:

127.0.1.1 domain.com
to /etc/hosts

StuartK24 11-28-2016 05:07 AM

Thanks to you both. I changed the line 127.0.1.1 to my domain, and set the ServerName in apache2.conf to the same domain name. This has gotten rid of the error message.

Habitual 11-28-2016 06:24 AM

Glad it worked out.


All times are GMT -5. The time now is 12:09 AM.