Question: how do apache virtual hosts work?
Answer: Apache automatically discriminates on the basis of the HTTP Host header supplied by the client whenever the most specific match for an IP address and port combination is listed in multiple virtual hosts. The ServerName directive may appear anywhere within the definition of a server.