macos httpd: Could not reliably determine the server's fully qualified domain name, using . Set the 'ServerName' directive globally to suppress this mess code example

Example 1: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.123.156. Set the 'ServerName' directive globally to suppress this message

If you go to:

/etc/apache2/apache2.conf
and insert:

ServerName localhost   
and then restart apache by typing into the terminal:

sudo systemctl reload apache2

Example 2: mac httpd: Could not reliably determine the server's fully qualified domain name, using

Uncomment this line in httpd.conf

ServerName localhost

The problem is that on macOS it is the wrong file (not /private/etc/httpd.conf).

To find the right location of your httpd.conf Apache configuration file, run:

apachectl -t -D DUMP_INCLUDES
then double check whether ServerName is uncommented and set to localhost.

Tags:

Misc Example