joelrondeau
Dabbler
- Joined
- Jan 28, 2012
- Messages
- 13
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:
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 192.168.0.10, you could pick 192.168.0.11.
For the subnet mask, you will probably want a standard class C subnet (255.255.255.0).
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.
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:
nginx_enable="YES"
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;
}
Now, create the media directory and subdirectories. After they've been created, use the FreeNAS web interface to add mount points.
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.
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:
- Setup a BSD Jail
- Install and configure nginx
- 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 192.168.0.10, you could pick 192.168.0.11.
For the subnet mask, you will probably want a standard class C subnet (255.255.255.0).
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:
pkg_delete -f pcre-8.30_2 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:
nginx_enable="YES"
Code:
cd /etc 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:
cd /usr/local/etc/nginx chmod 666 nginx.conf vi nginx.conf 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:
cd /usr/local/www mkdir media cd media mkdir videos mkdir music 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.