[HOWTO] Serve up media to Roksbox from a FreeNAS jail

Discussion in 'Configuration' started by joelrondeau, Dec 30, 2012.

  1. Offline


    Member Since:
    Jan 28, 2012
    Message Count:
    Likes Received:
    Trophy Points:
    Software Engineer
    Glendale, WI
    joelrondeau, Dec 30, 2012

    There are 2 threads in hacking to get FreeNAS to serve up media to the Roku RoksBox. This is a more proper way to do it that doesn't involve any changes to FreeNAS files.

    Roksbox is a private channel for the Roku media player that is used to stream local content to the Roku.

    This guide was made using FreeNAS 8.3. I expect small changes will be necessary for different versions.

    Here are the basic steps:
    1. Setup a BSD Jail
    2. Install and configure nginx
    3. Configure Roksbox

    Step 1: Setup a BSD Jail

    To set up the BSD jail, follow the directions in the documentation.
    Create a volume for the jail (mine is called "jail") and a volume for the jail archive (mine is called "jailarchive").
    Install the 8.3 jail pbi.
    For the IP address, pick an address on the same subnet as the NAS. I just picked the IP 1 more than my NAS. So if your NAS is, you could pick
    For the subnet mask, you will probably want a standard class C subnet (

    Once the jail is installed, it is a good idea to create a snapshot. That will make it much easier to go back to a good starting point if something is goofed up along the way (I only did this 2 or 3 times while getting everything setup).

    Step 2: Install and configure nginx

    Use SSH to login to your FreeNAS (obviously, enable SSH on the FreeNAS if you haven't already).
    Login as root
    Login to the jail (most likely via "jexec 1 tcsh")

    First, get nginx. If you just use pkg_add, there's a conflict with pcre. So that needs to be deleted first.
    Code (text):
    2. pkg_delete -f pcre-8.30_2
    3. pkg_add -r nginx
    Next, modify rc.conf to enable nginx. I'm using vi to modify the rc.conf file.
    Add the following line to the end of rc.conf:
    Code (text):
    2. cd /etc
    3. vi rc.conf
    Now, modify nginx.conf to add the media directory (we'll create that later) and turn on autoindexing. Autoindexing is only necessary if you do not use xml files for everything. The nginx.conf file is set as read-only, so that has to be changed before modifying the file, and changed back afterwards.

    Go into nginx.conf and after the section that starts with
    location /
    Add the following lines:

    location /media {
    alias /usr/local/www/media;
    autoindex on;

    Code (text):
    2. cd /usr/local/etc/nginx
    3. chmod 666 nginx.conf
    4. vi nginx.conf
    5. chmod 444 nginx.conf
    Now, create the media directory and subdirectories. After they've been created, use the FreeNAS web interface to add mount points.

    Code (text):
    2. cd /usr/local/www
    3. mkdir media
    4. cd media
    5. mkdir videos
    6. mkdir music
    7. mkdir photos
    We need 3 mount points, 1 each for videos, music and photos. The source is the location of the media. The destination is the directory we just created. For my 3 mount points, they look like this:
    Videos source: /mnt/d0/movies/M4V, destination: /usr/local/www/media/videos
    Music source: /mnt/d0/music, destination: /usr/local/www/media/music
    Photos source: /mnt/do/photos, destination: /usr/local/www/media/photos

    Step 3: Configure Roksbox

    Set the media IP address to match your FreeNAS jail IP (not the standard FreeNAS IP).
    Set the media root folder to "media"
    Set the video folder path to "videos"
    Set the music folder path to "music"
    Set the photo folder path to "photos"

    I use an xml file (Videos.xml) to store my video information. For each video, start the path with media/videos/
    I do not use an xml file for music or photos. I expect similar settings are necessary.

Share This Page