Sometimes when we start or restart Apache2 The following error appears in the terminal:
Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
Which means:
The correct domain name for the server could not be determined, 127.0.0.1 will be used as ServerName
To solve it we simply must execute the following command:
echo "ServerName localhost" >> /etc/apache2/conf.d/fqdn
The above command must be executed with administrative privileges, either using the account of root or putting at the beginning of the command sudo
This will be enough to solve the problem, from now on when they start or restart Apache2 they will no longer show that error.
regards
Friend, I imagine that this must be in Debian, since in Ubuntu 13.04 and 13.10, it no longer exists, the conf.d folder in apache2, greetings
In case it does not exist, there is no problem with creating it 😉
I had the problem, but I must have solved it some other way, because I don't have that file .. thanks anyway, I struggled a lot as I remember!
comment: sudo doesn't work as suggested, it should be something of the form
echo "ServerName localhost" | sudo tee /etc/apache2/conf.d/fqdn
I only mention it because it is a common mistake, to assume that putting sudo in front of anything is the same as being as root. In this case, the redirect of the output is valued before sudo comes into play, and the common user does not have write permission to that location
I have a question, is there a difference between this solution and this other?
Create the httpd.conf file inside / etc / apache2
and write to that file:
ServerName localhost
and then save it.
Do the two solutions do the exact same thing?
Prepending sudo to the command's ppio will only execute the 'echo' as root, and the write will fail.
A little trick for these cases with redirects:
sudo bash -c 'echo "ServerName localhost" >> /etc/apache2/conf.d/fqdn'
: )
Regards!
And why not put the ServerName domain.name.com directive in the /etc/apache2/apache.conf file?
Thank you so much…..!!!!
Excellent Information, I have solved a problem and I have taken a headache. With this I solved an INTERNAL SERVER ERROR that it gave me when starting a system in PHP5.
On Ubuntu 14.04:
echo "ServerName localhost" | sudo tee /etc/apache2/conf-available/fqdn.conf
sudo a2enconf fqdn
And for freebsd with the "apache22" service? 🙁
I solved the error, thank you very much