Zhixian's Tech Blog

2014-11-21

How to configure ServerName directive globally for Apache HTTP Server

After installing Apache HTTP Server, you may notice that that when you restart the service, you may get the following annoying message:

Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1. Set the ‘ServerName’ directive globally to suppress this message

zhixian@SARA: ~_017

To get rid of this message, you need to define a ServerName for your Apache HTTP Server.
To achieve this, you need to:

  1. Define a “fqdn.conf” file in Apache HTTP Server’s available configuration folder.
  2. Enable the “fqdn.conf” configuration
  3. Restart Apache HTTP Server

Implementation Details

1. Define “fqdn.conf”

Apache HTTP Server’s available configuration folder can be found at:

/etc/apache2/conf-available/

To create the “fqdn.conf” file, enter the following command into a terminal session:

echo “ServerName localhost” | sudo tee /etc/apache2/conf-available/fqdn.conf

zhixian@SARA: ~_018

What this command does is to write the string “ServerName localhost” into a file “fqdn.conf” at “/etc/apache2/conf-available/”.

2. Enable configuration

To enable the “fqdn.conf” that we just added to Apache HTTP Server, enter the following command in a terminal session:

sudo a2enconf fqdn.conf

zhixian@SARA: ~_019

3. Restart Apache HTTP Server

To restart the Apache HTTP service, enter the following command in a terminal session:

sudo service apache2 reload

zhixian@SARA: ~_020

After you restart the service, you should no longer see set “ServerName directive globally” message.

Reference:

http://askubuntu.com/questions/256013/could-not-reliably-determine-the-servers-fully-qualified-domain-name

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: