How do Set the 'ServerName' directive globally to suppress this message in OS X
Andrew Henderson
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
#ServerName localhost:8080What am I missing that this message still appears?
12 Answers
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
#ServerName localhost:8080Note 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
ServerName localhost:8080Then restart Apache and you should be able to access that Apache server at as expected.
Add a line to your fully qualified hostname to the apache configuration:
LINE='ServerName
FILE='/etc/apache2/apache2.conf'
grep -qF -- "$LINE" "$FILE" || echo "$LINE" >> "$FILE"
service apache2 restartIf your server has no domain, use localhost instead