Macos – How do Set the ‘ServerName’ directive globally to suppress this message in OS X

apache-http-servermacos-mojave

I'm getting this error message when starting Apache. I'm using macOS Mojave 10.14.5.

AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using Stevens-MacBook-Air.local. Set the 'ServerName' directive globally to suppress this message httpd (pid 856) already running

I added the name server in the httpd.conf file but still am coming up with this error message.

# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80
#ServerName localhost:8080

What am I missing that this message still appears?

Best Answer

I added the name server in the httpd.conf file but still am coming up with this error message.

Sorry to say but no, you didn’t. This is effectively what you have:

# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80
#ServerName localhost:8080

Note how all of the lines above #ServerName localhost:8080 have # prepended to them. That means they are commented out. Look around that config file; there are other lines that are commented as well as commented out. To make your setting take effect, you need to uncomment it like this.

# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80
ServerName localhost:8080

Then restart Apache and you should be able to access that Apache server at http://localhost:8080 as expected.

Related Question