June 2012
« May   Jul »

Flash Media Server : Setting up Virtual hosting

it’s a very rare senario you need to host the multiple streaming projects in a same server. Because streaming server would have hosted in a highend server having plenty of RAM and good disk I/O performance for a big project. My situation is I would have to provide demo site for diff. streaming projects.

Here is the technique I used,

1. Create a folder configuration for virtualhost

We may need create a specified folder structure for each FMS project. This folder name will exactly same as the domain name we used for fms. ie Adobe has put a template folder under “/opt/adobe/fms/conf/” which named as “_defaultVHost_”. Make a copy a this folder to create new virtual FMS hosting.

[root@rc-090 _defaultRoot_]# pwd
[root@rc-090 _defaultRoot_]# cp -r _defaultVHost_/
[root@rc-090 _defaultRoot_]#

2.Modifying the “AppsDir” in Vhost.xml file

Update the file (Vhost.xml) inside the domain folder and change the streaming location directive ( ${VHOST.APPSDIR}) to where all our video files are copied.

[root@rc-090]# pwd
[root@rc-090]# cat Vhost.xml | egrep "<AppsDir>"

Here I uses “/home/site1/public_html/streams” folder to upload all my videos.

3. Prepare the Streaming directory

This is the final part of the application setup. We need to create a folder structure again to play the videos 🙂 .
I create a folder “app” for streaming folder and copy all the video under “_definst_” . You can access any streaming file based on the floder you’ve created. ie

Physical path : /home/site1/public_html/streams/app/_definst_/sample.flv
rtmp url : rtmp://

[root@rc-090 streams]#mkdir /home/site1/public_html/streams/app/_definst_

Folder structure will be,

[root@rc-090 streams]# tree app
`-- streams
    `-- _definst_
        `-- sample.flv
2 directories, 1 file
[root@rc-090 streams]#
[root@rc-090 rtmp]# tree  /opt/adobe/fms/conf/_defaultRoot_/
|-- Adaptor.xml
|-- _defaultVHost_
|   |-- Application.xml
|   `-- Vhost.xml
|   |-- Application.xml
|   `-- Vhost.xml
|   |-- Application.xml
|   `-- Vhost.xml
    |-- Application.xml
    `-- Vhost.xml
4 directories, 9 files
[root@rc-090 rtmp]#

Alright !! We’ve all done 🙂

4. Restarting FMS server

We need to restart FMS to take new configuration.

[root@rc-090 fms]# /opt/adobe/fms/server restart
NPTL 2.5
Stopping Adobe Flash Media Server (please check /var/log/messages)
Server has shutdown...
Starting Adobe Flash Media Server (please check /var/log/messages)

4. Testing RTMP virtual hosting

There is a nice command line tool rtmpdump to validate or download file from a streaming path. This is tool is good for quick rtmp testing. So we need to install.

[root@rc-090 rtmp]# wget
[root@rc-090 rtmp]# tar -zxvf rtmpdump-2.3.tgz
[root@rc-090 rtmp]# cd rtmpdump-2.3
[root@rc-090 rtmp]# make && make install
[root@rc-090 rtmp]# rtmpdump --v
RTMPDump v2.3
(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL

Now the tool is installed. It’s usage is ” rtmpdump -r ” rtmp url” -o output.flv“. Now I’m going to verify my streaming site.

[root@rc-090 rtmp]# rtmpdump -r "rtmp://" -o test.flv
RTMPDump v2.3
(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
Connecting ...
INFO: Connected...
Starting download at: 0.000 kB
INFO: Metadata:
INFO:   duration              24.96
INFO:   width                 320.00
INFO:   height                180.00
INFO:   videodatarate         543.00
INFO:   framerate             24.00
INFO:   videocodecid          4.00
INFO:   audiodatarate         128.00
INFO:   audiodelay            0.03
INFO:   audiocodecid          2.00
INFO:   canSeekToEnd          TRUE
2015.500 kB / 24.97 sec (100.0%)
Download complete
[root@rc-090 rtmp]#

Whoola .. it’s working and I can see the test.flv file working. You can also validate the rtmp url by playing the video using my java script file which can be download from here Just download it on any web location and update the rtmp path and file name which suit to your settings.

Viewing the FMS log files for all the streaming access to ensure the virtual hosting is working.

 [root@rc-090 rtmp]# tail -f /opt/adobe/fms/logs/access.00.log

See the screen shown below,

Njoy !!

3 comments to Flash Media Server : Setting up Virtual hosting

  • Prem Jose

    Dear Liju,

    Thanks for a great blog.. really its so useful .. can you share any document For Windows 2008 Vhost configuration for FMS 4.5 ..kindly suggest .one of my client is using Windows platform ..I would appreciate if you help..thanks in advance

    Prem Jose

    • Hello,

      creating virtulhost is fairly easy as it’s just of creating folders based on the virtualhost domain name using the FMS given template. But you would need sufficient tools to verify it.


  • Good to know something like this.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>