Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 with the IIS server and those requests for 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.

share|improve this question

migrated from Sep 4 '11 at 14:10

This question came from our site for professional and enthusiast programmers.

closed as off topic by Jason Berg, Ward, Shane Madden, Chris S, Scott Pack Sep 5 '11 at 19:08

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

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.

share|improve this answer
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 '11 at 13:27
Great addition, @cHao – Lars Sep 4 '11 at 17:59

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(.*)[iis_port#]$1 [R]

# or the whole host
RewriteCond %HTTP_HOST%
RewriteRule (.*)[iis_port#]$1 [R]

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

share|improve this answer