IIS and WAMP using same IP and port 80.

New to mod_rewrite? This is a good place to start.

IIS and WAMP using same IP and port 80.

Postby GroundLoop » Thu Jul 16, 2009 8:05 pm

I have a Small Business Server install that I would like to have both IIS and Apache (WAMP) running. I need IIS due to SBS services, Sharepoint, and one existing ASP.NET website, otherwise I would ditch IIS. Basically, I would like to have both sharing the same port and IP so both can be seen from the outside world. From my research, mod_rewrite is a good option. Right now, the IP of the server is 192.168.2.4 ,IIS is 192.168.2.4 and Apache is 192.168.2.8. So I thought I could put Apache on 192.168.2.4:80 and then change IIS port 80 to 81 and use mod_rewrite to connect to the IIS website. Can someone please point me in the right direction. Can all of this be done in the VirtualHost section of the Apache httpd.conf file?


I currently have uncommented:

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule rewrite_module modules/mod_rewrite.so

and this for the virtual host in the httpd.conf file:

<VirtualHost 192.168.2.8:80>
ServerName www.domain.biz
RewriteEngine On
ProxyVia Block
ProxyPreserveHost On
RewriteRule ^/(.*)$ http://www.domain.biz:81/$1 [P,L]
RewriteCond C:/Inetpub/websites/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ http://localhost:3001/$1 [P,L]
</VirtualHost>

with 192.168.2.8 being open to the outside world all other Apache websites function fine. And IIS website is listening on port 81 and IIS website works from outside world if you put :81 on the end of it.

Thank you for any and all help.
GroundLoop
 
Posts: 6
Joined: Tue Jul 14, 2009 6:45 am

Postby richardk » Fri Jul 17, 2009 10:43 am

Which requests need to go to the IIS server? How will mod_rewrite be able to tell? Do they have a specific HTTP_HOST, path, etc.?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby GroundLoop » Fri Jul 17, 2009 11:09 am

richardk wrote:Which requests need to go to the IIS server?

Anything that matches www.domain.biz

richardk wrote:How will mod_rewrite be able to tell?
Not sure what you mean, other than I thought it would be able to tell by adding a rewrite rule in the virtualhost to redirect to IIS if the request = www.domain.biz ?

richardk wrote:Do they have a specific HTTP_HOST, path, etc.?

Just standard IIS file path: C:\inetpub\wwwroot\domain\
GroundLoop
 
Posts: 6
Joined: Tue Jul 14, 2009 6:45 am

Postby richardk » Fri Jul 17, 2009 12:53 pm

It was really all one question.

Try
Code: Select all
<VirtualHost 192.168.2.8:80>
  ServerName domain.biz
  ServerAlias www.domain.biz

  ProxyRequests Off

  <Proxy *>
    Order deny,allow
    Allow from all
  </Proxy>

  ProxyPass        / http://192.168.2.8:81/
  ProxyPassReverse / http://192.168.2.8:81/
</VirtualHost>
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby GroundLoop » Mon Jul 20, 2009 6:36 am

Thanks!. That was it. Only thing I had to do was replace the IP address in the ProxyPass and ProxyPassReverse statement with www.domain.biz. I think this will work for exposing the Sharepoint website with a friendly name to the outside world too.
GroundLoop
 
Posts: 6
Joined: Tue Jul 14, 2009 6:45 am


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 28 guests

cron