Active Directory Products
Calls To Calendar
SMS To CSV
SMS To Gmail
Voicemail To Gmail
How Long For Me
<< Back To All Blogs
Apache And IIS Meet In The Middle
Thursday, September 14th, 2006
Over the past few weeks I have been trying to setup my network so that I can have an external request to a domain such as whatever.tomhearn.com be forwarded internally to another computer on the network, and on a different port. The hard part about this setup is that I have one IP address, and I want the requests to be resolved to go to 2 different servers. I wanted to do this because I have one server running Apache (linux programs) and another server running windows (ASP.NET and Windows program). So here is the rundown for all of you that are interested, because I could not find a good website describing how to do this with my current setup:
So for those of you that don't know how my network is setup with my website server, it is pretty confusing at times, and it is often limited by the router that is serving our entire network. For a brief overview of my server/network setup it is as follows:
Comcast Digital Cable Internet with Single IP, static
Linksys WRT54-G with 4-port switch and LAN uplink
Server 1 (BETA): Fedora Core 3 Running Apache 2, MySQL 4, Etc.
Server 2 (CHARLIE): Windows Server 2003 Running IIS 6, MSSQL 2000, Etc.
The Internal IP for BETA is 192.168.20.101
The Internal IP for CHARLIE is 192.168.20.105
These are static IPs and they need to be for hosts file modification.
I will refer to the servers herein as the name in parenthesis above.
This setup is almost entirely on the Linux (BETA) side of things. The only modification to CHARLIE was that I added a port header for port 81 to accept HTTP connections to my default website.
I modified the router to point all incoming requests to port 81 to CHARLIE. It had already been set to forward all port 80 requests to BETA.
I then modified the Hosts file on the linux box to add charlie to the hosts listing, including any aliases. So on top of my existing Hosts file I added the following:
192.168.20.105 CHARLIE charlie.network.tomhearn.com charlie.localhost
Restart the network and you are done with the Hosts file.
The next part is the Apache configuration. Fire up httpd.conf to edit the Apache settings. Note that you must have a proxy server enabled on your server for this to work, if it was not installed when you configured Apache you will have to re-compile Apache to include mod_proxy.
Disable normal Proxy Requests:
Set the permissions for proxy requests:
Allow from all
Add your virtual host with the ProxyPass and ProxyPassReverse calls:
ServerAlias *.whatever.tomhearn.com:80 whatever.tomhearn.com:80
ProxyPass / http://CHARLIE:81/
ProxyPassReverse / http://CHARLIE:81/
Please note that this is considering you are using dynamic Named Virtual Hosts. If you need to enable named virtual hosts you can do so with wildcarding by adding the following above your virtual host entries:
NameVirtualHost *:80 *:443 (443 if you are using SSL)
If you are using IP-Based VirtualHosts you will need to change the *:80 in the VirtualHost definition to your IP Address.
Restart Apache and you are ready to rock. Make sure it works by entering the domain name in your web browser and booyaka, you are in business.
If anyone has any questions about this process let me know, I don't think I've left anything out but if any part is unclear I'll fix it so it isn't.
Currently no comments.
Add A Comment
Email Address: (not public, used to send notifications on further comments)
Enter the text above, except for the 1st and last character: