Wowza 4.x – Multiple vhosts

The Wowza Streaming Engine software can be configured to run multiple virtual host (VHost) environments on a single server. This lets multiple users share a server in separate environments. Each VHost environment has its own set of configuration files, application folders, and log files and can be configured with its own system resource and streaming limitations

User guide: https://www.wowza.com/resources/WowzaStreamingEngine_UsersGuide.pdf
Tutorial referal made by me: https://www.wowza.com/forums/showthread.php?35355-VHost-ERROR

My example that i wanted to achieve:
new virtual host: vhost01
ipaddress : 192.168.10.17
streaming port: 1936

Step 1. add new virtual host to /conf/VHosts.xml

<?xml version="1.0" encoding="UTF-8"?> 
<Root version="1"> 
        <VHosts> 
                <VHost> 
                        <Name>_defaultVHost_</Name> 
                        <ConfigDir>${com.wowza.wms.ConfigHome}</ConfigDir> 
                        <ConnectionLimit>10</ConnectionLimit> 
                </VHost> 
                <VHost> 
                        <Name>vhost01</Name> 
                        <ConfigDir>${com.wowza.wms.ConfigHome}/vhost01</ConfigDir> 
                        <ConnectionLimit>0</ConnectionLimit> 
                </VHost> 
        </VHosts> 
</Root>

Step 2.Directory structure to copy the files to: this is what the structure should be.

[install-dir]  
    [defaultVHost]  
    [applications]  
    [conf]  
        Application.xml  
        clientaccesspolicy.xml  
        crossdomain.xml  
        MediaCache.xml  
        StartupStreams.xml  
        Tune.xml  
        VHost.xml  
        admin.password  
        publish.password  
    [content]  
    [keys]  
    [logs]  
    [transcoder]  
    [newVHost]  // vhost01 
        [applications]  
        [conf]  
            Application.xml  
            clientaccesspolicy.xml  
            crossdomain.xml  
            MediaCache.xml  
            StartupStreams.xml  
            Tune.xml  
            VHost.xml  
            admin.password  
            publish.password (Optional, see Notes below)  
        [content]  
        [keys]  
        [logs]  
        [transcoder]

Step 3. so the vhost01 structure should be placed in /usr/local/WowzaStreamingEngine/vhost01 if you look at the directory structure
note: if i look at step 1 the vhost01 should be placed in the config directory (${com.wowza.wms.ConfigHome}/vhost01) <= i will ignore this one

copy the files to /usr/local/WowzaStreamingEngine/vhost01 (just like the directory structure says and ignoring the directory class from the VHosts.xml

root@wowza40:/usr/local/WowzaStreamingEngine# mkdir vhost01 [enter] 
keeping it simple copy directories and files: 
root@wowza40:/usr/local/WowzaStreamingEngine# cp -r applications/ conf/ content/ keys/ logs/ transcoder/ /usr/local/WowzaStreamingEngine/vhost01/  [enter] 

now remove unnessesary files from config and log directory 
root@wowza40:/usr/local/WowzaStreamingEngine# cd conf/ [enter] 
root@wowza40:/usr/local/WowzaStreamingEngine/conf# rm jmxremote.access jmxremote.password log4j.properties publish.password PushPublishMap.txt Server.guid Server.license Server.xml 
root@wowza40:/usr/local/WowzaStreamingEngine/conf# cd ../logs [enter] 
root@wowza40:/usr/local/WowzaStreamingEngine/vhost01/logs# rm -r * [enter]

#note: you might want to remove your applications too in your new vhost directory. i was lazy

Step 4. The above changes only take place when you restart the wowza server. but first setup your log to follow problems that might occur

follow error log before reboot: root@wowza40:/usr/local/WowzaStreamingEngine/logs# tail -f wowzastreamingengine_error.log

now you can restart the server from the browser : go to the streamingmanager (ip:8088). and restart the server.
restarting………. checking error log
darn:

Error##: --       -       vhost01 Bind failed, try again ([any]:1935): java.net.BindException: Address already in use

Thats correct: the new vhost should run on a different port. lets set it to 1936 (page 63 from the user guide)

Refresh your browser: F5
you now can see under Server -> vhost01. click vhost01
then go on the left to Virtual Host Setup
click in the middle on Edit and change the Host Ports
Default Streaming / Streaming / * / 1935 / false
to
Default Streaming / Streaming / 192.168.10.17 (server ip) / 1936 / false
apply -> save -> restart vhost + check your error log again that is still running

error log is changing: from any ip to the new ip i have set:

WARN    vhost   comment 2014-02-17      23:25:38        -       -       -       -       -       348.93  -       -       -       - --       -       vhost01 Bind failed, try again ([any]:1935): java.net.BindException: Address already in use 
WARN    vhost   comment 2014-02-17      23:25:43        -       -       -       -       -       353.938 -       -       -       - --       -       vhost01 Bind failed, try again ([any]:1935): java.net.BindException: Address already in use 
WARN    vhost   comment 2014-02-17      23:25:47        -       -       -       -       -       358.416 -       -       -       - --       -       vhost01 Bind failed, try again (192.168.10.17:5085): java.net.BindException: Address already in use

now also port 5085 is present which is also available in the default vhost.

you know what?
press F5 in your browser and just restart the complete server.
this will activate the port change (1936). only the admin port is still present now

#Software: Wowza Streaming Engine 4.0.0.00 build10425 
#Date: 2014-02-17 
#Fields: x-severity     x-category      x-event date    time    c-client-id     c-ip    c-port  cs-bytes        sc-bytes        x-duration x-sname x-stream-id     x-spos  sc-stream-bytes cs-stream-bytes x-file-size     x-file-length   x-ctx   x-comment 
WARN    server  comment 2014-02-17      23:28:35        -       -       -       -       -       3.155   -       -       -       - --       -       -       REST API: Loading XML: Invalid number format (8087,8088) for /Root/Server/RESTInterface/Port/text() 
WARN    vhost   comment 2014-02-17      23:28:40        -       -       -       -       -       7.786   -       -       -       - --       -       vhost01 Bind failed, try again (192.168.10.17:5085): java.net.BindException: Address already in use 
WARN    vhost   comment 2014-02-17      23:28:45        -       -       -       -       -       12.795  -       -       -       - --       -       vhost01 Bind failed, try again (192.168.10.17:5085): java.net.BindException: Address already in use

How do i get rid of the 5085 notice?

in your browser go to your vhost01 -> virtual host setup -> edit -> Host Ports and delete the line Default Admin from the Host Ports -> Save and restart the vhost after that. nothing happens.
go to server Setup and just restart the complete server
annnd gone. no more errors
to make sure. follow your access.log :

tail -f /usr/local/WowzaStreamingEngine/logs/wowzastreamingengine_access.log

and restart the complete server to check if the vhosts are binded and if everything is starting. check the access.log and just restart it to check if the new vhost get binded

2014-02-17      23:36:58        CET     comment vhost   INFO    200     vhost01 Bind attempt (192.168.10.17:1936:4)     -       - -8.004   -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       - --       -       -       -       -       -       -       - 
2014-02-17      23:36:58        CET     comment vhost   INFO    200     vhost01 Bind successful (192.168.10.17:1936)    -       - -8.014   -       -       -       -       -       -

when i check the error.log after i have created an live application i get a new error:

WARN    server  comment 2014-02-17      23:39:29        -       -       -       -       -       159.207 -       -       -       - --       -       -       REST API: Server request (GET): Resource not found-404: https://localhost:8087/v1/server/vhosts/vhost01/applications/live_vhost01  
WARN    server  comment 2014-02-17      23:56:14        -       -       -       -       -       1163.869        -       -       - --       -       -       -       Application folder ([install-location]/applications/vhost01) is missing

i can solve this error by changing the file VHosts.xml in /usr/local/WowzaStreamingEngine/conf/VHosts.xml

from:

${com.wowza.wms.ConfigHome}/vhost01

to:

/usr/local/WowzaStreamingEngine/vhost01

 

this error looks to me of an error in the Setup. {comb.wowza.wms.ConfigHome} = /usr/local/WowzaStreamingEngine/conf but should be above the conf directory according to the directory structure.

it is working eventually, but some things aren’t documented correctly. To test a stream to the new vhost i add this address in my flme

rtmp://192.168.10.17:1936/live_vhost01

where the ip is my server ip.
the port is from the new vhost
and live_vhost01 is just a test application i have setup unde the new vhost.

Note: sometimes the browser isnt updating after a restart. because i wanted to use the testplayer in wowza to test my new live stream and it wanted to connect to rtmp://192.168.10.17:5085. after an F5 it was corrected to 1936

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *