I am hosting two separate sites with two separate domain names on the same server. Without using some kind of NAT forwarding, how can I set up my apache server so that, depending on which domain is used, the index.html file from a different directory is referenced?
This question will probably be migrated to Server Fault shortly, but the basic answer is that you need to set up a Virtual Host for each of the domain names. This page has a thorough description but a basic example would be:
<VirtualHost *> DocumentRoot /path/to/site1 ServerName site1.com </VirtualHost> <VirtualHost *> DocumentRoot /path/to/site2 ServerName domain2.com </VirtualHost>
you will need a static ip address (or service that forwards to your ip address - pain in the back side as far as I'm concerned)...
but once you have that then you will need to configure virtual hosts...
If you have apache 2.2 you should have a 'extra' folder under 'conf' in your apache directory.
In this you will find httpd-vhost.conf which gives you the basic idea.
Finally in your main apache config file you will need to uncomment the line that includes teh vhost config...
# Virtual hosts #Include conf/extra/httpd-vhosts.conf
and the line that loads the vhost module
#LoadModule vhost_alias_module modules/mod_vhost_alias.so