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

I am new to Apache web server. When we configure Apache web server, we have the options of setting name-based virtual host.

Based on my understanding, when a user type in a domain name in a web browser, it will connect to a DNS server which will convert the domain name to a (public) IP address. Then, the web browser will connect to the web server using the IP address.

Now, let's say I have a server with a public IP address, a.a.a.a. I have registered 2 domain names, and Both of these 2 domain names are pointing to the same IP address, a.a.a.a. So, when user types in or in his web browser, the DNS server will point them to the IP address a.a.a.a.

I have configured name-based virtual host according to the user guide at this web site.

However, what I don't understand is: Since the DNS server already converted domain names to IP address, all users will connect to the web server using IP address a.a.a.a. How Apache knows whether the user is using or in their web browser?

share|improve this question
up vote 3 down vote accepted

The http header will contain the host. In your example above, this would be or This host header is read by apache and then used to send the client the correct vhost.

share|improve this answer

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.