[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: hostname question

On Thu, 31 Dec 2009 12:41:03 +0100, www.givemefish.com wrote:

> I have a home server setup running Lenny.  I have a question about the
> hostname and domain name.
> On my server, I would like to host multiple websites using Apache and
> virtual hosts.


Let me first recommend you the reading of a very good article covering 
Apache2 virtual hosts concept an management (name-based, not ip-based)):

Name-based Virtual Host Support

> My question is, how should my /etc/hosts file look.  Here is what my
> current hosts file looks like:
>       localhost
>       MyLocalHostName.MyLocalDomainName   MyLocalHostName


Do not care much about this, just be sure your DNS server (the 
responsible to resolve the domains you are going to host) is properly 
configured and redirecting the queries to your router.

Once the queries reach your server, Apache2 will handle the domains, 
based on the setup you have specified for each of them.

> My questions are:
> *) Should I use the static IP assigned by my ISP or on the router?  Or
> is the above correct?

If you have a DNS server making the resolutions for you, I guess /etc/
hosts files is not that relevant.
> *) Can / should the local domain name (used in /etc/hosts) be different
> from the domain name of the website(s) that I am hosting?  ie, using
> MyLocalDomainName rather than domainname I have registered for my
> website.

If you are using your own DNS resolver, then yes, they have to match. But 
not in /etc/hosts file but /var/lib/named (bind9) or whatever are loacted 
the files to configure your DNS server.

> If I should use the registered domain name, how do I handle hosting
> multiple domains on this server?  Which domain name would I use?

Apache2 handles on its own the domain name resolution, better read the 
documentation I gave you before.
> *) How does this differ from what is saved in /etc/hostname?  What if
> these values differ?  Who uses /etc/hostname?

My wild guess is that "/etc/hostnames" is only used when you need to 
resolver the named locally (on your intranet) but if you want the domain 
names become available globally (on Internet) you should care the DNS 
server settings, not /etc/hosts.

> *) My current /etc/hostname contains the single line:
> MyLocalHostName.MyLocalDomainName
> Is that correct?

It will depend on your desired configuration. 

How are you (or who is) managing the DNS server in charge of name 



Reply to: