Reverse Proxy Server: IIS back-end server

From The Uniform Server Wiki
Revision as of 18:22, 23 September 2008 by Ric (talk | contribs) (New page: {{Uc nav reverse proxy server}} '''Uniform Server - IIS''' Apache is an awesome web server it will even run ASP applications just install [http://www.apache-asp.org/ Apache::ASP] and you...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

MPG UniCenter

MPG UniCenter

Uniform Server 3.5-Apollo
Reverse Proxy.

Uniform Server - IIS

Apache is an awesome web server it will even run ASP applications just install Apache::ASP and you are ready to go. Alternatively you could use that redundant IIS server sitting on your machine and run the appropriate ASP apps from it.

IIS Server

Hay! No way am I suggesting making it your main server, it needs putting in its place and that’s as a back-end server. On the previous page you saw how easy it is to run Uniform Server as a proxy. Make the modifications to your main server this gives you Apache and MySQL a powerful combination now proxy to IIS. OK IIS sucks for anything but using ASP.Net however at least you will have a set-up to explore.

Pain:

IIS is a pain when you try to tweak it, have a go at setting it as a proxy server and you will get some idea what I mean. Apache does it straight out of the box. In theory you should be able to run all your servers on port 80 and bind to different IP addresses. However IIS is a royal pain and grabs everything associated with the port it’s running on and that includes every IP address on the machine.

That said it is relatively easy to change the port it runs on however it is version specific. Below I have listed the common versions full details for other versions can be found at Microsoft support.

Top

Change IIS port

Change the IIS port for example 81 using Internet Service Manager, each site must bind to port 81.

Microsoft Internet Information Server version 3.0
  1. Open Internet Service Manager.
  2. Double-click on the computer corresponding to the WWW service.
  3. On the Service tab, change the TCP Port field to the desired port number (81).
  4. Click OK.
  5. Using the Internet Service Manager, stop and restart the IIS Services.


Microsoft Internet Information Services versions 4.0 to 6.0
  1. Open Internet Service Manager or Internet Information Services (IIS) Manager.
  2. If necessary, expand the Web server that you want, and then expand Web Sites.
  3. Right-click the Web site that you want to change.
  4. Click Properties.
  5. Click the Web Site tab.
  6. Change the TCP Port Number in the TCP Port edit box (or click Advanced for multiple Port settings).
  7. Click OK to save the changes.

Load your ASP apps and check they run.

Top

Uniform Server

For this tutorial you can use either Uniform Server 3.5-Apollo or mini-server 20 for the front-end server. They both require the same proxy files (modules), mini-server 20 comes complete with matching modules these cannot be used with Apollo if you decide to use Uniform server as a proxy server follow the instruction below to obtain the correct versions.

Top

Uniform Server 3.5-Apollo Proxy Files

The required files for running a proxy server are not included with Uniform Server 3.5 no big deal. Go to Apache archive download site and download file apache_2.0.59-win32-x86-openssl-0.9.7j.msi to extract the binaries follow the instructions on this page Support and download.

mod_proxy.so
mod_proxy_http.so
mod_proxy_ftp.so
mod_proxy_connect.so

Copy these four files to folder:

\Uniform Server\udrive\usr\local\apache2\modules

Edit Apache's configuration file: httpd.conf
Located in folder: \Uniform Server\udrive\usr\local\apache2\conf

Locate these lines:

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so 

Un-comment as shown. (remove the hash #)

Restart server for the settings to take place.

That completes the set-up you can now use proxy commands in your configuration file this I cover this later.

Top

Vhost Set-up

The set-up is similar to that shown on the previous page. Edit httpd.conf as shown. Located in folder: *\Uniform Server\udrive\usr\local\apache2\conf

NameVirtualHost *
<VirtualHost *>
 ServerName localhost:80
 DocumentRoot /www

ProxyRequests off
<Proxy *>
  Order deny,allow
  Deny from all
  Allow from 127.0.0.1
</Proxy>

ProxyPassReverse / http://localhost:81/

RewriteEngine On
# Add a rewrite rule for each .Net app you wish to proxy.
RewriteRule ^/DotNetApp(.*)$ http://localhost:81/DotNetApp/$1 [P,L]

</VirtualHost>

Notes:

Note: port 81 If you set a different port for IIS use that

Depending on your application you may need to preserver host headers try something like this:

NameVirtualHost *
<VirtualHost *>
 ServerName localhost:80
 DocumentRoot /www

ProxyRequests off
<Proxy *>
  Order deny,allow
  Deny from all
  Allow from 127.0.0.1
</Proxy>

RewriteEngine On
ProxyVia Block
ProxyPreserveHost On
# Add a rewrite rule for each .Net app you wish to proxy.
RewriteRule ^/DotNetApp(.*)$ http://localhost:81/DotNetApp/$1 [P,L]

</VirtualHost>

Notes:

Note: port 81 If you set a different port for IIS use that

Top

Summary

It’s a shame! I have no examples for you to run, however the above shows the basic principals of proxying to IIS.

Top


Ric