Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com 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 professional 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.

2 Answers 2

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
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 '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(.*) 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.

share|improve this answer