1

I currently have IIS running on my webserver at home and I am using DNS2Go to provide a static domain name. My old websites use ASP with VB Script and an Access Database through ODBC drivers and my newer websites use APACHE, PHP and MySQL. I want to be able to still serve the ASP pages along side the PHP pages and as far as I know I can set up both servers on one computer as long as I use diffrent port numbers.

How would I handle requests for http://domain.myip.org/iis/ with the IIS server and those requests for http://domain.myip.org/apache/ with the appache server? Really I would like to be able to do route the request to the right server for any directory I like.

2 Answers 2

5

As some users are behind corporate firewalls and do not have any possibility to access ports other than 80 or 443, you should not simply redirect the users to other ports, but instead proxy the requests through. While this means using more ressources of apache, it helps some users a lot.

You achieve this by letting apache2 run on port 80 and IIS on some other port, e.g. 10080. In apache2's configuration file, you use the following directive to proxy through requests on special urls:

ProxyPass /iis/ http://localhost:10080/
ProxyPassReverse /iis/ http://localhost:10080/

You need an active mod_proxy-module for that and may use rewrites for further functionality, e.g. only proxying specific suburls to the IIS.

2
  • 1
    Add to the reasons for proxying rather than redirecting: the port number is actually an implementation issue that users shouldn't know or care about. Redirection sticks the port number in the URL, and makes things a pain to bookmark -- if you ever have to change the port numbers later, bookmarks will likely become invalid.
    – cHao
    Sep 4, 2011 at 13:27
  • Great addition, @cHao
    – Lars
    Sep 4, 2011 at 17:59
0

Well, first what comes to my mind - let apache live at port 80 and use mod_rewrite to redirect specific paths to another port.

# replace [iis_port#] with something like 8080 or wherever you put it
RewriteRule ^/iis(.*) http://www.domain.myip.org:[iis_port#]$1 [R]

# or the whole host
RewriteCond %HTTP_HOST% www.domain.iis.myip.org
RewriteRule (.*) http://www.domain.iis.myip.org:[iis_port#]$1 [R]

This is pretty straightforward solution, so somebody might post something better.