Personally I like using a reverse proxy in apache when serving multiple servers behind one IP address. I wrote up an article on this a few years ago.
There may be times when you need to have multiple web servers, but you have been given only one Public IP Address. The issue you will run into is that you want to have your multiple domains resolve the same IP address, but point to a different server. This is very doable with Apache. I configured a gateway server within my private cloud with an address of 192.168.1.2. I have several web servers with local addresses; 192.168.1.10 and 192.168.1.11 for example.
On my Gateway server, I install Apache and the mod_proxy files. Once this is complete, I am able to set up the virtual hosts to forward the domain.
<VirtualHost *:80>
DocumentRoot /var/www/example.org
ServerName *.example.org
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPreserveHost on
ProxyPass / http://192.168.1.10/
ProxyPassReverse / http://192.168.1.10
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/example.com
ServerName *.example.com
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPreserveHost on
ProxyPass / http://192.168.1.11/
ProxyPassReverse / http://192.168.1.11/
</VirtualHost>
Restart Apache and configure your router to accept incoming connections to the 192.168.1.2 local address. Though I could have pointed the DocumentRoot to the same location (i.e. /var/www), but I usually have .htaccess files for each site where I can force SSL (redirect 80 to 443 on specific domain names).
The nice thing about this route is that you can serve multiple HTTPS servers with the same IP Address. The only issue is that Internet Explorer doesn't recognize the VirtualHost port 443 or named host and you would get a certificate error. However, Safari, Firefox and Chrome all recognize each individual certificate for the domain that is being proxied.
Internet Explorer on Windows Vista, Windows 7, Windows 8, and Windows 10 have the "Server Name Indication" feature to recognize virtual hosts. Only Internet Explorer on Windows XP and older lack this. – Damian Yerrick – 2016-11-08T19:16:02.877
This is exactly what I want to do, but since I am currently using Windows active directory server as my DNS, I was hoping to accomplish this in IIS, so that I can keep all of the gateway/authentication stuff in my network on the same server - do you know how to do this in IIS? – William – 2013-06-03T23:24:10.013
Lol, sorry, I do not. However, what version of IIS you running? – kobaltz – 2013-06-03T23:25:00.343
IIS 8 - if I wanted to figure out to do it on my own - do you have any hints at least? Keywords that I should search for? I'm sort of a n00b when it comes to web servers (I promise that I'm good at other stuff though!) – William – 2013-06-03T23:43:11.617