Sie sind auf Seite 1von 4

apache2 - Could not reliably determine the server's fully qualified d...

Community

Ask!

Developer

Design

Discourse

Hardware

Insights

Juju

Shop

More

1 of 4

Ubuntu

http://askubuntu.com/questions/256013/could-not-reliably-determine...

join this community

tour

help

Sign up

Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Could not reliably determine the server's fully qualified domain name?
When I restart my apache server using the command
sudo /etc/init.d/apache2 restart

I get the following error:


Restarting web server apache2
apache2: Could not reliably determine the server's fully qualified domain name, using
127.0.1.1 for ServerName
... waiting apache2:
Could not reliably determine the server's fully qualified domain name, using 127.0.1.1
for ServerName

Is the server using 127.0.1.1 instead of 127.0.0.1? What causes this error?
server

apache2

edited Nov 28 '14 at 0:27


Seth
18k

asked Feb 14 '13 at 13:09


Deepu

16

73

1,232

119

8 Answers

Deepu
1,232

13.04 and older

I am currently B.tech Final year student in NIT , Hamirpur ,


H.P.
My interest is in coding , photography , learn new things
related to computer and to pass time with my friends.

This is just a friendly warning and not really a problem (as in that something does not work).
If you insert a
ServerName localhost

in either httpd.conf or
disappear.

apache2.conf

If you have a name inside


And it uses

127.0.1.1

in

/etc/hostname

if it is inside your

/etc/apache2

and restart apache the notice will

you can also use that name instead of

/etc/hosts

localhost

127.0.0.1 localhost
127.0.1.1 myhostname

Preferred method
Troubleshooting Apache
If you get this error:
apache2: Could not determine the server's fully qualified domain name,
using 127.0.0.1 for ServerName

then use a text editor such as "sudo nano" at the command line or "gksudo gedit" on the
desktop to create a new file,
sudo nano /etc/apache2/conf.d/fqdn

or
gksu "gedit /etc/apache2/conf.d/fqdn"

then add
ServerName localhost

to the file and save. This can all be done in a single command with the following:
echo "ServerName localhost" | sudo tee /etc/apache2/conf.d/fqdn

But on Ubuntu 14.04:


echo "ServerName localhost" | sudo tee /etc/apache2/conf-available/fqdn.conf
sudo a2enconf fqdn

Don't forget the ".conf" (without will not work).


edited Nov 28 '14 at 0:10
s3v3n
303

answered Feb 14 '13 at 13:18


Rinzwind

14

105k

12

194

286

thanks this worked Deepu Feb 14 '13 at 13:58

11/1/2015 8:04 AM

apache2 - Could not reliably determine the server's fully qualified d...

2 of 4

http://askubuntu.com/questions/256013/could-not-reliably-determine...

This is also mentioned in the Ubuntu LAMP setup documentation for Troubleshooting Apache. There they
recommend creating a file /etc/apache2/conf.d/fqdn with ServerName localhost in it icc97 Jun 29 '13 at
9:36
Very good answer - but I would also recommend putting it in the conf.d directory :) cwd Sep 26 '13 at
22:42

2
3

/etc/apache2/conf.d/ does not exist after my install of lamp-server^ in 14.04 redanimalwar May 3 '14

at 7:51

For the very last step (creating sym-link in 14.04) I'd recommend sudo a2enconf fqdn though it should
technically be the same. yoshi Jun 18 '14 at 15:04

13.10 or newer
As of Apache 2.4 - which is available by default as of 13.10 - you cannot use the method about
adding a config file in the conf.d directory.
Apache no longer uses the
/etc/apache2/conf-available

extension.

directory. All the configuration files are stored inside


directory and all the configuration files should now have a .conf

conf.d

In order to solve this message in Apache 2.4, we have to create a configuration file inside the
conf-available directory. For example servername.conf .
sudo vi /etc/apache2/conf-available/servername.conf

And inside this we just need to add one line


ServerName localhost

You can combine the previous two commands in one with:


echo "ServerName localhost" | sudo tee /etc/apache2/conf-available/servername.conf

If you want to use a domain name or any other name depending on the requirement its fine,
just replace localhost with whatever you need. Next you have to enable this configuration.
For this, you need to run the following command:
sudo a2enconf servername
a2enconf is a command to enable a configuration file in Apaches 2.4. Also note that
servername on the above command is from the name of the configuration file servername.conf .
If your configuration file was ngenericserver.conf then you would have to write sudo a2enconf
ngenericserver .

After this reload the server and the above message will no longer bug you.
sudo service apache2 reload

or
sudo apache2ctl graceful

Now after this you will see that the message will not be shown again and the problem will be
fixed.
Source: http://ngeneric.com/tutorials/linux/apache2/fix-could-not-reliably-determine-serversfully-qualified-domain-name-error
edited Jan 20 '14 at 11:15
Dan
3,591

answered Dec 26 '13 at 18:45


Starx

23

51

1,741

21

33

Does anybody know how to make Apache say which config file it's having the problem with? I don't know
why developers never think to put this in their error messages - it hardly takes much code! John Yeates Jul
8 '14 at 10:08
If I have an Internet fqdm for this server, is this the place to put it? ie should I substitude myhost.org in place
of localhost? CPBL Aug 14 '14 at 16:54
1

@CPBL This will be the default server name for all sites. If you only have one site, then that's all you need
to do. If you have multiple sites on your server, you will also need to add the servername directive for each
site in their respective virtual host configuration. Dan Oct 7 '14 at 17:12
Works on 14.04 LTS. Parto Jun 29 at 6:34
Your quoted link seems dead, please fix. Fredrick Gauss Aug 27 at 7:56

Open a terminal
Open the

/etc/apache2/httpd.conf

file:

sudo editor /etc/apache2/httpd.conf # [1]

By default, it would be blank. Simply add the following line:


ServerName localhost

Save the file and exit


Restart the server
sudo service apache2 restart

11/1/2015 8:04 AM

apache2 - Could not reliably determine the server's fully qualified d...

3 of 4

[1] Launch default editor, see

http://askubuntu.com/questions/256013/could-not-reliably-determine...

sudo update-alternatives --config editor

edited Sep 21 '14 at 13:50

answered Feb 14 '13 at 13:17

muru
42.6k

green
8

60

8,816

105

21

48

after executing last command the following error occur ** Restarting web server apache2 /usr/sbin
/apache2ctl: 87: ulimit: error setting limit (Operation not permitted) /usr/sbin/apache2ctl: 87: ulimit: error
setting limit (Operation not permitted) (13)Permission denied: make_sock: could not bind to address
0.0.0.0:80 no listening sockets available, shutting down Unable to open logs Action 'start' failed. The Apache
error log may have more information. [fail] ** @green7 Deepu Feb 14 '13 at 13:52
try 'sudo service apache2 restart' waterloo2005 Apr 15 '13 at 3:09

Apache2 can also get the FQDN from a properly configured system hostname rather than
hardcoded into the apache config file. Hardcoding it will also cause confusion if the hostname
changes. You actually don't need any ServerName directives in httpd.conf or any apache
config files.
Put the following in

/etc/hosts

# IPv4 and IPv6 localhost aliases


127.0.0.1 hostname.domainname.com
::1
hostname.domainname.com

where

hostname.domainname.com

hostname
hostname

localhost
localhost

is the FQDN of your machine.

Along with a properly configured hostname in /etc/hostname/ or with hostnamectl , this will
also help other services on your machine run properly (i.e. the login prompt, showing This
hostname.domainname.com instead of This is hostname.unknown_domain .)

is

answered Sep 18 '13 at 18:05


Andrew Mao
413

12

+1 for "a properly configured system hostname". I wanted to configure the server properly. This also fixed
my error in the log [warn] RSA server certificate CommonName (CN) <fqdn> does NOT match server
name!? transistor1 Apr 16 '14 at 3:21
Do you think this should work with Apache 2.2.22? I am still getting "Could not reliably determine the
server's fully qualified domain name, using 127.0.1.1 for ServerName" David Winiecki Apr 12 at 5:08

In new version of apache2 you just following command like this:


sudo nano /etc/apache2/apache2.conf

Add the following new line end of file:


ServerName localhost

Then restart apache2:


sudo nano service apache restart

It's done.
edited Apr 16 '14 at 7:04

answered Apr 16 '14 at 6:38

Radu Rdeanu
62.2k

I find it is a bit better to create a new file in


httpd.conf .

19

empugandring

130

/etc/conf.d

31

222

that to modify either

apache2.conf

or

It's a personal preference that keeps my configuration changes separated from the distribution
package. So updates are less complicated.
I create the file

/etc/apache2/conf.d/AAserverName

and it contains only:

ServerName myhost.mycomain.tld

The other suggestions certainly work also.


edited Jul 5 '14 at 10:36

answered Sep 6 '13 at 15:31

Sneetsher
15k

Add

areeda

33

31

69

ServerName localhost

To
sudo leafpad /etc/apache2/apache2.conf
sudo leafpad /etc/apache2/httpd.conf

It's not an error.. It's just a friend reminder


answered Jul 5 '14 at 9:36
Serem
11

11/1/2015 8:04 AM

apache2 - Could not reliably determine the server's fully qualified d...

4 of 4

http://askubuntu.com/questions/256013/could-not-reliably-determine...

On Ubuntu 11.10, I saw this message, along with a hung boot occurring because my disk was
full. One of the log files had gone rogue. Probably there was not actually a problem with
Apache, but this message was the last clue given before the boot hung.
To fix the problem, I had to boot into recovery mode and remove the wayward log file.
answered May 7 '13 at 15:17
nobar
632

12

protected by Raja Jul 5 '14 at 9:56


Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.
Would you like to answer one of these unanswered questions instead?

11/1/2015 8:04 AM