Localhost Apache 2 Server Warning On Ubuntu 11

19th September 2011

I was recently setting up a localhost environment with Ubuntu 11 and after adding all of my needed VirtualVost directives I found that I could start/restart the server but that I found the following error when trying to start the server.

  1. [email protected]:/etc/apache2/sites-available$ sudo apache2ctl -k start
  2. apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName

To fix the problem you needed to add a simple directive to the Apache httpd.conf file. In order to access this file you'll need be have admin access, so open up a terminal window and type the following command.

sudo gedit /etc/apache2/httpd.conf

Don't worry if the file you open is empty, it is meant to be. The httpd.conf file is a user editable file that you can add directives to in order to configure your Apache install. What we need to do with this file is enter a directive that will give the server a name. Because we are not using a DNS server (as it is local) we need to let Apache know what to call itself. Enter the following directive.

  1. ServerName localhost

Save this file and close it. When you are done you can restart the server by typing in the following command.

sudo apache2ctl -k restart

Your Apache server will now start with no annoying warnings or errors (as long as the rest of your configuration is correct).

Comments

Permalink

apache is awesome, but  nginx is way more efficient.

Anonymous coward (Wed, 09/21/2011 - 08:41)

Add new comment

The content of this field is kept private and will not be shown publicly.