This setup is fairly common; what you want is called Name-based Virtual Hosting. There is a pretty good tutorial on this on the Apache website here
. I have set my systems up using a relatively stock httpd.conf file, to which I have added a line at the very end including a separate configuration file that defines the <VirtualHost> containers, one for each name that should be recognized.
There are two caveats: first, the log files and DocumentRoot that are declared in the main httpd.conf file are almost never used when you have virtual hosts defined. Instead, each virtual host gets its own, and all the references to that virtual host get logged in the host-specific logfiles. Second, when the server cannot figure out which VirtualHost to use, it used the first one defined. This is usually the case before you get DNS configuration done; at that point, the incoming name (www.foo.com
) does not translate to any IP address that the server knows about, and so it uses the first Virtual Server it can find. This is pretty confusing at first, as it makes pages from that virtual server appear in response to a request for any of your servers.
Good luck, and post again if you have more detailed questions.