# Could not determine the server's fully qualified domain name

## themoebius

Whenever I try to bring up eth1, which is connected to my cable modem, I get this error.

```
moe-server ~ # /etc/init.d/apache2 restart

 * Stopping apache2...

apache2: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName                        [ ok ] * Bringing eth1 up...

 *   eth1 (

(: Unknown host

ifconfig: `--help' gives usage information.                                                                                  [ !! ]

 * Starting apache2...

apache2: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName                        [ ok ]

```

my /etc/hosts looks like this. I'm not too sure what I'm supposed to have in there or even the correct syntax for it, but here it is:

```

127.0.0.1       localhost

themoebius.ath.cx localhost

127.0.0.1       moe-server

192.168.1.1     moe-server

192.168.1.17    moebius.workgroup moebius

192.168.1.16    moe-laptop2.workgroup moe-laptop2

```

Thanks for any help.

----------

## Anime_Fan

What you need is to set /etc/hostname and /etc/dnsdomainname, as well as start /etc/init.d/hostname and /etc/init.d/domainname in the boot runlevel.

If you've setup everything correctly, you can try to execute the  command `hostname --fqdn`, and see an FQDN returned (HOSTNAME.DOMAIN.TLD).

Or, if you're lazy, just set the variable ServerName in /etc/apache2/apache2.conf

----------

## themoebius

ok I'm just not understanding hostnames and domains properly. I just bought a web server that I'm sharing with my friend to host our client's websites on. Which means I'm not using just one domain. I'm not sure what I should set it to. Furthermore, I'm not sure what I should set the hostname to. Does it really matter? Right now the hostname is just "debian" Should I change it to the IP of the server?

Also, what should I set in things like the postfix server for mydomain and myhostname? I don't want to be stuck with one domain. For instence my domain is zacwittedesign.com and my friend's domain is culture graphic.com so he doesn't want his clients incoming mail server to be mail.zacwittedesign.com and visa versa. Is there a way I can have mail.clientdomain.com? On http://www.postfix.org/postconf.5.html#myhostname it says my hostname should be my fully qualified domain name. Since I don't want to specify a paricular domain name, can I just put the IP of the server?

But I'm not just worried about postfix, it goes for most other things as well. I guess I'm not too sure on what the exact deffinition of "hostname" and domainname" is... I need help figuring out what to put for /etc/hostname, /etc/hosts, /etc/dnsdomainname and in the config files for various servers.

Thanks for helping me through this.

----------

## smutt

I have a similar setup on a box I manage.  Apache will complain if he can't get his domain from getdomainname().  The thing to remember is that setting the domain of the box doesn't limit what domains Apache or qmail can respond to.  You should assign a domain to the box that Apache and qmail/postfix should recognize, but it doesn't have to be the only domain that the box can service.  You should pick a domain name for the box that you own of course and that resolves in DNS to that box.  Once you set the domain of the box then you can setup Apache and your mail mta to do virtual hosting.

Which is a whole other topic  :Smile: 

You can pick anything for a hostname just make sure it's in DNS if you want to get to it directly.  I Like cartoon characters personally  :Smile: 

Here's some definitions  for a machine named skippy.example.com

hostname = skippy

domainname = example.com

fully qualified domain name(FQDN) = skippy.example.com

----------

## rodericj

 *Anime_Fan wrote:*   

> What you need is to set /etc/hostname and /etc/dnsdomainname, as well as start /etc/init.d/hostname and /etc/init.d/domainname in the boot runlevel.
> 
> If you've setup everything correctly, you can try to execute the  command `hostname --fqdn`, and see an FQDN returned (HOSTNAME.DOMAIN.TLD).
> 
> Or, if you're lazy, just set the variable ServerName in /etc/apache2/apache2.conf

 

wheredoes hostname --fqdn get the information from? Does it come from /etc/hosts?

I think I may have that set up wrong.

----------

## chrisstankevitz

 *Anime_Fan wrote:*   

> Or, if you're lazy, just set the variable ServerName in /etc/apache2/apache2.conf

 

I want to do this right, but I do not want to be lazy.  Consider this:

computer behind nat router.  port forwarding sends http traffic to internal apache machine

Should I just make up some fake hostname and domainname and let apache use that?  Or should I be "lazy" and put my public IP address in /etc/apache2/apache2.conf ServerName?

Thanks,

Chris

----------

## cpdsaorg

just add the ip address and hostname to your /etc/hosts file

ie: /etc/hosts

```
127.0.0.1        localhost

192.168.1.xxx    servername     servername.mydomain.tld
```

----------

## minskpower

 *themoebius wrote:*   

> Whenever I try to bring up eth1, which is connected to my cable modem, I get this error.
> 
> my /etc/hosts looks like this. I'm not too sure what I'm supposed to have in there or even the correct syntax for it, but here it is:
> 
> ```
> ...

 

Don't add multiple entries in hosts for the same ip. Do something like this:

```

127.0.0.1 localhost moe-server 

x.x.x.x  themoebius.ath.cx

```

----------

## cpdsaorg

here is my correction...

```

127.0.0.1       localhost

192.168.1.1     moe-server.ath.cx moe-server

192.168.1.17    moebius.workgroup moebius

192.168.1.16    moe-laptop2.workgroup moe-laptop2

```

----------

