Hosts

Bob George plug-discuss@lists.plug.phoenix.az.us
Fri, 28 Feb 2003 12:20:31 -0700


"Don Fitz" <dfitzsimmons@cox.net> wrote:
> A question from a rookie to the hard core. I am using name based
> hosting with Apache and I want to test my sites before I run them live.
> I have heard that adding the domain to the hosts file temporarily will
> allow me to fool my server into thinking that it is looking at the
> actual domain because it checks the hosts file before dns. Is this
> true? Is there a better way to do this?

If /etc/host.conf is set to read the hosts file first (order hosts,bind),
you should be fine doing it by editing the hosts file. I recall this setting
was previously in /etc/resolv.conf with other distributions, so do check the
manpages for your distribution.

What you probably want to do is add the FULL hostname (FQDN) to /etc/hosts
rather than just the domain name (i.e. www.domain.tld) to keep it simple.

Setting up local DNS isn't particularly complicated, but it strikes me as
cumbersome if you just want to quickly test web pages.

Just don't forget that you've set it this way, and it should be easy to
add/remove entries as required!

- Bob