Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I'm setting up VirtualHosts (this is my first time doing this) on my Rackspace cloud does the URL in my browser have to be the name for it to work correctly? What I mean is, if I set my local host file on OS X to my current development server will it still work, or does the DNS actually have to point to the development server?

Does this make sense? I set up my server for the first time this week, so I could be totally off-base here.

share|improve this question
up vote 1 down vote accepted

The DNS is irrelevant and a hosts entry will be fine. Some detail as to why this is:

When your browser sends a web request it sends headers along with it. One of these headers is the "Host" header. If I try to hit your server by IP, a Host header will be omitted (or will contain the IP) and will not match your Name-Based VirtualHost declaration. Apache uses this Host header to decide what pages to serve when multiple sites are hosted on the same IP address.

The hosts method of forcing a browser to send a Host header that does not match (or even look up) DNS is a typical way to do testing and development environments.

share|improve this answer
Good! Just a sidenote: At work the host-force thing doesn't work, but at home it does. Any idea why it would work on one network and not the other? – Kevin Brown Jun 8 '11 at 14:14
You're using a proxy at work, most likely. When you send a request to a proxy it gets a URL (like to retrieve on your behalf. It uses it's own hostname resolution to decide where this needs to go. – Kyle Smith Jun 8 '11 at 14:15
Well, that's just disappointing. Thanks! – Kevin Brown Jun 8 '11 at 14:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.