Fix Apache2 error "Could not reliably determine the server's fully qualified domain name, using for ServerName"

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 for ServerName

Which means:

The correct domain name for the server could not be determined, 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.


The content of the article adheres to our principles of editorial ethics. To report an error click here!.

10 comments, leave yours

Leave a Comment

Your email address will not be published.



  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   firecold said

    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

    1.    KZKG ^ Gaara said

      In case it does not exist, there is no problem with creating it 😉

  2.   lucas said

    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

  3.   Andy said

    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?

  4.   hackan said

    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'
    : )


  5.   Edgardo said

    And why not put the ServerName directive in the /etc/apache2/apache.conf file?

  6.   Manuel Diaz said

    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.

  7.   Mauricio Lopez said

    On Ubuntu 14.04:

    echo "ServerName localhost" | sudo tee /etc/apache2/conf-available/fqdn.conf
    sudo a2enconf fqdn

  8.   Joseph said

    And for freebsd with the "apache22" service? 🙁

  9.   ruben said

    I solved the error, thank you very much

bool (true)