I updated MacOS Sierra's Apache and PHP, and now whenever I $ sudo apachectl restart I get this:

AH00557: httpd: apr_sockaddr_info_get() failed for My-MacBook-Pro.local
AH00558: httpd: Could not reliably determine the server's fully qualified
domain name, using Set the 'ServerName' directive globally to
suppress this message

Things I've tried so far that didn't work:

  • Setting ServerName localhost in /etc/httpd.conf
  • Setting ServerName localhost:80 in /etc/httpd.conf
  • Setting ServerName in /etc/httpd.conf
  • Setting ServerName in /etc/httpd.conf
  • Ensuring localhost is set in /etc/hosts
  • Repeatedly restarting Apache
  • 1
    How did you update Apache and PHP and why because usually it's not recommended to modify the system's Apache & PHP
    – klanomath
    May 17, 2017 at 14:35

6 Answers 6


When restart the httpd.


sudo /usr/sbin/apachectl restart

Don't use:

sudo apachectl restart
  • 3
    It worked, would you explain more why do I use sudo /usr/sbin/apachectl restart ? May 24, 2017 at 4:48
  • It's because you have two different installations of Apache - the one that came with the system and the one you installed yourself.
    – Allan
    May 26, 2017 at 14:06
  • 1
    Really helpfull for me
    – A.A Noman
    Oct 2, 2020 at 10:23

The error message you provided gives you the answer:

Set the 'ServerName' directive globally to suppress this message

So, in your httpd.conf file, you need to set the server name by un-commenting and editing the following line

#ServerName www.example.com:80


ServerName www.some-web-server.com

This should be done in the main httpd.conf and should be the FDQN (fully qualified domain name) of the server you are running. Keep in mind that this is for the main server. You can set individual server names in the VirtualHost definitions

For instance, if you called the server - mywebser.local, that should be the ServerName.

Personally, what I like to do, even in a home setup is to have a main definition that goes nowhere and is very restrictive and create virtual hosts in separate directories so each one can be referenced by a different hostname.


As per message:

Set the 'ServerName' directive globally to suppress this message.

you need to find your httpd.conf Apache configuration file for example by this command:

apachectl -t -D DUMP_INCLUDES

For example: /usr/local/etc/httpd/httpd.conf.

then edit it and uncomment the line with ServerName (make sure it has the valid server name). E.g.

ServerName localhost
  • If you read the question, you'll find this is one of the first things I tried, and it didn't work Nov 1, 2017 at 15:34
  • 2
    It's because you were editing the wrong httpd.conf, not in /etc, but the one suggested by apachectl, which on macOS is usually somewhere in /usr/local/etc/httpd/.
    – kenorb
    Nov 1, 2017 at 15:49
sudo /usr/sbin/apachectl restart

It's work!

  • Welcome to Ask Different!. Please refrain from adding comments in an Answer. The preferred way of saying 'thanks' around here is by up-voting good questions and helpful answers (once you have enough reputation to do so), and by accepting the most helpful answer to any question you ask (which also gives you a small boost to your reputation). Please see the About page and also How to Answer.
    – fsb
    Mar 3, 2020 at 20:11
  1. When restart the httpd, you should check which apachectl.

  2. Trying restart system apache server by sudo /usr/sbin/apachectl restart.

  3. If you install httpd24 via brew, you should edit your custom apache config.

    Try open $(brew --prefix)/etc/apache2/2.4/httpd.conf, edit the #ServerName www.example.com:80 to ServerName www.your-server.com:80.

    Then sudo apachectl restart will work.


I had the same problem on macOS High Sierra and the solutions here worked for me.

I edited the config file:


I uncommented and modified the line starting by #Servername with

Servername localhost:8080

This resolved the issue for me.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .