How to run Red 5 on a shared IIS server on port 80
Setting up Red5 on a box which also contains a web server can be a challenge if you are restricted to using specific ports because of a firewall. Here is how we set up Red5 on a Windows 2003 server which also contains a production IIS server.
Our firewall only allows traffic on ports 80 and 443. This is non-negotiable, so we needed to work around the requirement.
IIS was already using ports 80 and 443, so the system administrator made two additional IPs for Red5 to use, one for rtmp and one for http. He then changed the settings in the Default Website Properties in IIS Manager: In Web Site Identification: IP Address, instead of (All Unassigned), he selected the single IP which we wanted IIS to listen on. We did not want IIS to interfere with port 80 on the IPs used by Red5.
However, even after this change Red5 still would not start up. The error in the logs was “java.net.BindException: Address already in use: bind”
After a little more research we found this article:
The article explains that on IIS 6 you must use a tool called httpcfg.exe to disable socket pooling. Otherwise, IIS will continue to grab port 80 on all IPs available, no matter what you set in IIS Manager.
The link to Microsoft’s explanation of this in the Stefan Richter article is no longer good. Here is the correct link:
The red5.properties file for the server looks like this:
# HTTP http.host=220.127.116.11 http.port=80 https.port=8443 # RTMP rtmp.host=18.104.22.168 rtmp.port=1935 rtmp.event_threads_core=16 rtmp.event_threads_max=64 # event threads queue: -1 unbounded, 0 direct (no queue), n bounded queue rtmp.event_threads_queue=0 rtmp.event_threads_keepalive=60 rtmp.send_buffer_size=271360 rtmp.receive_buffer_size=65536 rtmp.ping_interval=5000 rtmp.max_inactivity=60000 rtmp.tcp_nodelay=true # RTMPT #rtmpt.host=22.214.171.124 rtmpt.host=red501.myserver.com rtmpt.port=80 rtmpt.ping_interval=5000 rtmpt.max_inactivity=60000 # MRTMP mrtmp.host=126.96.36.199 mrtmp.port=9035 mrtmp.event_threads_core=4 mrtmp.event_threads_max=32 # event threads queue: -1 unbounded, 0 direct (no queue), n bounded queue mrtmp.event_threads_queue=0 mrtmp.event_threads_keepalive=60 mrtmp.send_buffer_size=271360 mrtmp.receive_buffer_size=65536 mrtmp.ping_interval=5000 mrtmp.max_inactivity=60000 mrtmp.tcp_nodelay=true # Debug proxy (needs to be activated in red5-core.xml) proxy.source_host=127.0.0.1 proxy.source_port=1936 proxy.destination_host=127.0.0.1 proxy.destination_port=1935
After this was done, Red5 did start up, but I started getting “no application scope found” errors in the logs, and then it would shut down after a few moments. After a little experimentation I realized that I must have made some fatal change to one of the configuration files while we were troubleshooting, so I simply reinstalled Red5. Then it started up immediately and stayed up.
The last step was to register the new IPs with our firewall, and now it works perfectly!
by Stefan Richter