Running Red5 Server alongside IIS

Ravensounddjs development team

If you are running your own webserver and Red5 alongside it then you might be tempted to run both your webserver and Red5 apps on the same box. And why not, after all we don't all have multiple machines at our disposal.

The following configuration is one that I have set up several times. I am running IIS (Microsoft's Internet Information Server) and Red5) on the same server which uses Windows 2008 Server as its OS.
It's possible to use other webservers like Apache for this but in this tutorial I will focus on IIS and Red5 on Windows so keep that in mind if your setup is different.

The principles behind it are the same on any server: we want Red5 to use other ports than the standard 1935 because we want to use http tunneling. As you might know tunneling uses port 80 (usually used for 'normal' http website traffic) or port 443 which is common for SSL traffic. Both ports are often open on firewalls hence the tunneling there ;-)

The problem is that no two services on one IP address (read: our machine) can use the same port - we would end up having red5 and IIS competing for port 80, and one service would win. Should Red5 start up before IIS then it might grab port 80 and not allow any website (IIS) traffic through it, effectively making any website unavailable. that's when you would get the alert in IIS saying 'address is already in use'. Let that be your warning sign.

The whole problem is easily solved in a few steps.

Step 1 - Assign a second IP address to your server
If your server is hosted remotely simply ask your hosting provider for a second IP. Sometimes they charge for this but it's usually a $10 one off fee, that's all. Your host might ask you why you want the secondary IP, tell them you want to run 2 services on port 80.
If you are running your own server then assign a secondary IP yourself, how this is done is beyond the scope of this article. You'll find this information on the net.

Step 2 - Stop IIS grabbing all available IPs
By default IIs will bind to all IP addresses it can find. To prevent this from happening you need to disable socket pooling in IIS. This is quite easily done and you can see a full description in this article.

Addition: since this tutorial was released I have also installed Red5 on Windows 2008 Server and the process of stopping IIS grabbing all IPs is different to Windows 2008. You need to use a utility called httpcfg.exe, read about it here.
The following steps apply to Windows 2003 as well as Windows 2008.

Step 3 - Bind IIS to one IP address
For example say your host has assigned the following two IP addresses to your server: 123.123.123.1 and 123.123.123.2. We decide we want to bind 123.123.123.1 to IIS.
To do this open Internet Information Services Manager (start > control panel > Administrative Tools > Internet Information Services). Right-click on the first website listed and select 'Properties'. The following panel (or similar) should pop up:


In the dropdown next to 'IP Address' you can now select one of all IP addresses available on this machine. You should select the one of the two you have available. Also add any host headers if necessary and repeat this process for every site on your server, always making sure that no site has (All Unassigned) selected. Each site should bind to the same IP address, we will later bind Red5 to the other.
For information on host headers consult the Microsoft website. You should know how these work if you run your own webserver.

Step 4 - Bind Red5 to the other IP address
We are almost done. IP addresses in Red5 are configured via a file called Red5.properties. You can bind Red5 to any IP or all IPs available. By default Red5 tries to bind to all IPs available so we need to edit the Red5.properties file to change this.


Save the file, restart Red5, restart IIS and you are done. You can now run websites and Red5 on the same machine with http tunneling fully functional.